Display flag support for LB/InternalLB/NetworkACL rules

This commit is contained in:
Alena Prokharchyk 2014-02-21 13:28:16 -08:00
parent c2fa24a24c
commit 0f489732c8
33 changed files with 237 additions and 74 deletions

View File

@ -41,16 +41,17 @@ import com.cloud.utils.net.Ip;
public interface LoadBalancingRulesService { public interface LoadBalancingRulesService {
/** /**
* Create a load balancer rule from the given ipAddress/port to the given private port * Create a load balancer rule from the given ipAddress/port to the given private port
*
* @param openFirewall * @param openFirewall
* TODO * TODO
* @param forDisplay TODO
* @param cmd * @param cmd
* the command specifying the ip address, public port, protocol, private port, and algorithm * the command specifying the ip address, public port, protocol, private port, and algorithm
*
* @return the newly created LoadBalancerVO if successful, null otherwise * @return the newly created LoadBalancerVO if successful, null otherwise
* @throws InsufficientAddressCapacityException * @throws InsufficientAddressCapacityException
*/ */
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd,
Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException, Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol, Boolean forDisplay) throws NetworkRuleConflictException,
InsufficientAddressCapacityException; InsufficientAddressCapacityException;
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd); LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);

View File

@ -33,4 +33,6 @@ public interface NetworkACL extends InternalIdentity {
long getId(); long getId();
String getName(); String getName();
boolean isDisplay();
} }

View File

@ -73,4 +73,6 @@ public interface NetworkACLItem extends InternalIdentity {
*/ */
TrafficType getTrafficType(); TrafficType getTrafficType();
boolean isDisplay();
} }

View File

@ -31,9 +31,10 @@ public interface NetworkACLService {
* @param name * @param name
* @param description * @param description
* @param vpcId * @param vpcId
* @param forDisplay TODO
* @return * @return
*/ */
NetworkACL createNetworkACL(String name, String description, long vpcId); NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay);
/** /**
* Get Network ACL with specified Id * Get Network ACL with specified Id
@ -115,11 +116,12 @@ public interface NetworkACLService {
* @param icmpCode * @param icmpCode
* @param icmpType * @param icmpType
* @param newUUID TODO * @param newUUID TODO
* @param forDisplay TODO
* @return * @return
* @throws ResourceUnavailableException * @throws ResourceUnavailableException
*/ */
NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number, NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number,
Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID) throws ResourceUnavailableException; Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID, Boolean forDisplay) throws ResourceUnavailableException;
/** /**
* Associates ACL with specified Network * Associates ACL with specified Network
@ -130,6 +132,6 @@ public interface NetworkACLService {
*/ */
boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException; boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException;
NetworkACL updateNetworkACL(Long id, String customId); NetworkACL updateNetworkACL(Long id, String customId, Boolean forDisplay);
} }

View File

@ -90,6 +90,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
// ///////////////// Accessors /////////////////////// // ///////////////// Accessors ///////////////////////
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
public Long getIpAddressId() { public Long getIpAddressId() {
return ipAddressId; return ipAddressId;
} }

View File

@ -16,8 +16,7 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.loadbalancer; package org.apache.cloudstack.api.command.user.loadbalancer;
import org.apache.log4j.Logger; import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
@ -29,6 +28,7 @@ import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule; import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InsufficientAddressCapacityException;
@ -94,9 +94,15 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
description = "the load balancer scheme. Supported value in this release is Internal") description = "the load balancer scheme. Supported value in this release is Internal")
private String scheme; private String scheme;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
}
public String getAlgorithm() { public String getAlgorithm() {
return algorithm; return algorithm;
@ -215,7 +221,7 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
ApplicationLoadBalancerRule result = ApplicationLoadBalancerRule result =
_appLbService.createApplicationLoadBalancer(getName(), getDescription(), getScheme(), getSourceIpNetworkId(), getSourceIp(), getSourcePort(), _appLbService.createApplicationLoadBalancer(getName(), getDescription(), getScheme(), getSourceIpNetworkId(), getSourceIp(), getSourcePort(),
getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId()); getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getDisplay());
this.setEntityId(result.getId()); this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid()); this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) { } catch (NetworkRuleConflictException e) {

View File

@ -18,8 +18,7 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
@ -34,6 +33,7 @@ import org.apache.cloudstack.api.response.LoadBalancerResponse;
import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenter.NetworkType;
@ -116,10 +116,17 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB") @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB")
private String lbProtocol; private String lbProtocol;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
}
public String getAlgorithm() { public String getAlgorithm() {
return algorithm; return algorithm;
} }
@ -301,7 +308,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L
try { try {
LoadBalancer result = LoadBalancer result =
_lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(), getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(), _lbService.createPublicLoadBalancerRule(getXid(), getName(), getDescription(), getSourcePortStart(), getSourcePortEnd(), getDefaultPortStart(),
getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol()); getDefaultPortEnd(), getSourceIpAddressId(), getProtocol(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getOpenFirewall(), getLbProtocol(), getDisplay());
this.setEntityId(result.getId()); this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid()); this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) { } catch (NetworkRuleConflictException e) {

View File

@ -16,6 +16,7 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.loadbalancer; package org.apache.cloudstack.api.command.user.loadbalancer;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
@ -42,6 +43,9 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the Load Balancer") @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the Load Balancer")
private Long id; private Long id;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -54,6 +58,10 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd {
return id; return id;
} }
public Boolean getDisplay() {
return display;
}
@Override @Override
public long getEntityOwnerId() { public long getEntityOwnerId() {
ApplicationLoadBalancerRule lb = _entityMgr.findById(ApplicationLoadBalancerRule.class, getId()); ApplicationLoadBalancerRule lb = _entityMgr.findById(ApplicationLoadBalancerRule.class, getId());
@ -81,7 +89,7 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd {
@Override @Override
public void execute() { public void execute() {
CallContext.current().setEventDetails("Load balancer Id: " + getId()); CallContext.current().setEventDetails("Load balancer Id: " + getId());
ApplicationLoadBalancerRule rule = _appLbService.deleteApplicationLoadBalancer(getId(), this.getCustomId()); ApplicationLoadBalancerRule rule = _appLbService.updateApplicationLoadBalancer(getId(), this.getCustomId(), getDisplay());
ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getId())); ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getId()));
setResponseObject(lbResponse); setResponseObject(lbResponse);
lbResponse.setResponseName(getCommandName()); lbResponse.setResponseName(getCommandName());

View File

@ -16,6 +16,7 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.loadbalancer; package org.apache.cloudstack.api.command.user.loadbalancer;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
@ -59,6 +60,9 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule") @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule")
private String loadBalancerName; private String loadBalancerName;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -79,6 +83,10 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
return loadBalancerName; return loadBalancerName;
} }
public Boolean getDisplay() {
return display;
}
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////// API Implementation/////////////////// /////////////// API Implementation///////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////

View File

@ -19,9 +19,7 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.cloudstack.acl.RoleType;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
@ -32,6 +30,8 @@ import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse; import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
@ -95,9 +95,15 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny") @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny")
private String action; private String action;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
// ///////////////// Accessors /////////////////////// // ///////////////// Accessors ///////////////////////
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
}
public String getProtocol() { public String getProtocol() {
String p = protocol.trim(); String p = protocol.trim();

View File

@ -16,8 +16,7 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.network; package org.apache.cloudstack.api.command.user.network;
import org.apache.log4j.Logger; import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
@ -26,6 +25,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.NetworkACLResponse; import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
@ -57,6 +57,9 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
description = "Id of the VPC associated with this network ACL List") description = "Id of the VPC associated with this network ACL List")
private Long vpcId; private Long vpcId;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
// ///////////////// Accessors /////////////////////// // ///////////////// Accessors ///////////////////////
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
@ -73,6 +76,10 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
return vpcId; return vpcId;
} }
public Boolean getDisplay() {
return display;
}
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
// ///////////// API Implementation/////////////////// // ///////////// API Implementation///////////////////
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
@ -84,7 +91,7 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
@Override @Override
public void create() { public void create() {
NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId()); NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId(), getDisplay());
setEntityId(result.getId()); setEntityId(result.getId());
setEntityUuid(result.getUuid()); setEntityUuid(result.getUuid());
} }

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.List; import java.util.List;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
@ -80,9 +81,15 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny") @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny")
private String action; private String action;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
// ///////////////// Accessors /////////////////////// // ///////////////// Accessors ///////////////////////
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
}
public Long getId() { public Long getId() {
return id; return id;
@ -164,7 +171,7 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
CallContext.current().setEventDetails("Rule Id: " + getId()); CallContext.current().setEventDetails("Rule Id: " + getId());
NetworkACLItem aclItem = NetworkACLItem aclItem =
_networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(), getAction(), getNumber(), getSourcePortStart(), _networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(), getAction(), getNumber(), getSourcePortStart(),
getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId()); getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId(), this.getDisplay());
if (aclItem == null) { if (aclItem == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item");
} }

View File

@ -16,6 +16,7 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.network; package org.apache.cloudstack.api.command.user.network;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
@ -42,6 +43,9 @@ public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL") @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL")
private Long id; private Long id;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -50,6 +54,10 @@ public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd {
return id; return id;
} }
public Boolean getDisplay() {
return display;
}
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////// API Implementation/////////////////// /////////////// API Implementation///////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -76,7 +84,7 @@ public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd {
@Override @Override
public void execute() throws ResourceUnavailableException { public void execute() throws ResourceUnavailableException {
NetworkACL acl = _networkACLService.updateNetworkACL(id, this.getCustomId()); NetworkACL acl = _networkACLService.updateNetworkACL(id, this.getCustomId(), getDisplay());
NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl); NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
setResponseObject(aclResponse); setResponseObject(aclResponse);
aclResponse.setResponseName(getCommandName()); aclResponse.setResponseName(getCommandName());

View File

@ -16,12 +16,11 @@
// under the License. // under the License.
package org.apache.cloudstack.api.response; package org.apache.cloudstack.api.response;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
/** /**
* *

View File

@ -19,12 +19,12 @@ package org.apache.cloudstack.api.response;
import java.util.List; import java.util.List;
import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ApplicationLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { public class ApplicationLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse {
@ -88,6 +88,10 @@ public class ApplicationLoadBalancerResponse extends BaseResponse implements Con
@Param(description = "the list of resource tags associated with the Load Balancer", responseObject = ResourceTagResponse.class) @Param(description = "the list of resource tags associated with the Load Balancer", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags; private List<ResourceTagResponse> tags;
@SerializedName(ApiConstants.FOR_DISPLAY)
@Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
@Override @Override
public void setAccountName(String accountName) { public void setAccountName(String accountName) {
this.accountName = accountName; this.accountName = accountName;
@ -152,4 +156,8 @@ public class ApplicationLoadBalancerResponse extends BaseResponse implements Con
public void setLbInstances(List<ApplicationLoadBalancerInstanceResponse> lbInstances) { public void setLbInstances(List<ApplicationLoadBalancerInstanceResponse> lbInstances) {
this.lbInstances = lbInstances; this.lbInstances = lbInstances;
} }
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
} }

View File

@ -18,12 +18,12 @@ package org.apache.cloudstack.api.response;
import java.util.List; import java.util.List;
import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class LoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { public class LoadBalancerResponse extends BaseResponse implements ControlledEntityResponse {
@ -103,6 +103,10 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
@Param(description = "the list of resource tags associated with load balancer", responseObject = ResourceTagResponse.class) @Param(description = "the list of resource tags associated with load balancer", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags; private List<ResourceTagResponse> tags;
@SerializedName(ApiConstants.FOR_DISPLAY)
@Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
@ -183,4 +187,8 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
public void setLbProtocol(String lbProtocol) { public void setLbProtocol(String lbProtocol) {
this.lbProtocol = lbProtocol; this.lbProtocol = lbProtocol;
} }
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
} }

View File

@ -18,14 +18,14 @@ package org.apache.cloudstack.api.response;
import java.util.List; import java.util.List;
import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.api.EntityReference;
import com.cloud.network.vpc.NetworkACLItem; import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = NetworkACLItem.class) @EntityReference(value = NetworkACLItem.class)
public class NetworkACLItemResponse extends BaseResponse { public class NetworkACLItemResponse extends BaseResponse {
@ -81,6 +81,10 @@ public class NetworkACLItemResponse extends BaseResponse {
@Param(description = "Action of ACL Item. Allow/Deny") @Param(description = "Action of ACL Item. Allow/Deny")
private String action; private String action;
@SerializedName(ApiConstants.FOR_DISPLAY)
@Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
@ -132,4 +136,8 @@ public class NetworkACLItemResponse extends BaseResponse {
public void setAction(String action) { public void setAction(String action) {
this.action = action; this.action = action;
} }
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
} }

View File

@ -16,14 +16,14 @@
// under the License. // under the License.
package org.apache.cloudstack.api.response; package org.apache.cloudstack.api.response;
import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.api.EntityReference;
import com.cloud.network.vpc.NetworkACL; import com.cloud.network.vpc.NetworkACL;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = NetworkACL.class) @EntityReference(value = NetworkACL.class)
public class NetworkACLResponse extends BaseResponse { public class NetworkACLResponse extends BaseResponse {
@ -43,6 +43,10 @@ public class NetworkACLResponse extends BaseResponse {
@Param(description = "Id of the VPC this ACL is associated with") @Param(description = "Id of the VPC this ACL is associated with")
private String vpcId; private String vpcId;
@SerializedName(ApiConstants.FOR_DISPLAY)
@Param(description = "is ACL for display to the regular user", since = "4.4", authorized = {RoleType.Admin})
private Boolean forDisplay;
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
@ -58,4 +62,8 @@ public class NetworkACLResponse extends BaseResponse {
public void setVpcId(String vpcId) { public void setVpcId(String vpcId) {
this.vpcId = vpcId; this.vpcId = vpcId;
} }
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
} }

View File

@ -30,7 +30,7 @@ import com.cloud.utils.Pair;
public interface ApplicationLoadBalancerService { public interface ApplicationLoadBalancerService {
ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp, int sourcePort, ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp, int sourcePort,
int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException, NetworkRuleConflictException, int instancePort, String algorithm, long networkId, long lbOwnerId, Boolean forDisplay) throws InsufficientAddressCapacityException, NetworkRuleConflictException,
InsufficientVirtualNetworkCapcityException; InsufficientVirtualNetworkCapcityException;
boolean deleteApplicationLoadBalancer(long id); boolean deleteApplicationLoadBalancer(long id);
@ -39,6 +39,6 @@ public interface ApplicationLoadBalancerService {
ApplicationLoadBalancerRule getApplicationLoadBalancer(long ruleId); ApplicationLoadBalancerRule getApplicationLoadBalancer(long ruleId);
ApplicationLoadBalancerRule deleteApplicationLoadBalancer(Long id, String customId); ApplicationLoadBalancerRule updateApplicationLoadBalancer(Long id, String customId, Boolean forDisplay);
} }

View File

@ -34,7 +34,7 @@ import com.cloud.user.Account;
public interface LoadBalancingRulesManager { public interface LoadBalancingRulesManager {
LoadBalancer createPublicLoadBalancer(String xId, String name, String description, int srcPort, int destPort, long sourceIpId, String protocol, String algorithm, LoadBalancer createPublicLoadBalancer(String xId, String name, String description, int srcPort, int destPort, long sourceIpId, String protocol, String algorithm,
boolean openFirewall, CallContext caller, String lbProtocol) throws NetworkRuleConflictException; boolean openFirewall, CallContext caller, String lbProtocol, Boolean forDisplay) throws NetworkRuleConflictException;
boolean removeAllLoadBalanacersForIp(long ipId, Account caller, long callerUserId); boolean removeAllLoadBalanacersForIp(long ipId, Account caller, long callerUserId);

View File

@ -28,9 +28,10 @@ public interface NetworkACLManager {
* @param name * @param name
* @param description * @param description
* @param vpcId * @param vpcId
* @param forDisplay TODO
* @return * @return
*/ */
NetworkACL createNetworkACL(String name, String description, long vpcId); NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay);
/** /**
* Fetches Network ACL with specified Id * Fetches Network ACL with specified Id
@ -74,10 +75,11 @@ public interface NetworkACLManager {
* @param aclId * @param aclId
* @param action * @param action
* @param number * @param number
* @param forDisplay TODO
* @return * @return
*/ */
NetworkACLItem createNetworkACLItem(Integer sourcePortStart, Integer sourcePortEnd, String protocol, List<String> sourceCidrList, Integer icmpCode, Integer icmpType, NetworkACLItem createNetworkACLItem(Integer sourcePortStart, Integer sourcePortEnd, String protocol, List<String> sourceCidrList, Integer icmpCode, Integer icmpType,
NetworkACLItem.TrafficType trafficType, Long aclId, String action, Integer number); NetworkACLItem.TrafficType trafficType, Long aclId, String action, Integer number, Boolean forDisplay);
/** /**
* Returns Network ACL Item with specified Id * Returns Network ACL Item with specified Id
@ -131,11 +133,12 @@ public interface NetworkACLManager {
* @param icmpCode * @param icmpCode
* @param icmpType * @param icmpType
* @param customId TODO * @param customId TODO
* @param forDisplay TODO
* @return * @return
* @throws ResourceUnavailableException * @throws ResourceUnavailableException
*/ */
NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number, NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, Integer number,
Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId) throws ResourceUnavailableException; Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId, Boolean forDisplay) throws ResourceUnavailableException;
/** /**
* Associates acl with a network and applies the ACLItems * Associates acl with a network and applies the ACLItems

View File

@ -84,6 +84,9 @@ public class NetworkACLItemVO implements NetworkACLItem {
@Enumerated(value = EnumType.STRING) @Enumerated(value = EnumType.STRING)
Action action; Action action;
@Column(name = "display", updatable = true, nullable = false)
protected boolean display = true;
public NetworkACLItemVO() { public NetworkACLItemVO() {
this.uuid = UUID.randomUUID().toString(); this.uuid = UUID.randomUUID().toString();
} }
@ -245,4 +248,13 @@ public class NetworkACLItemVO implements NetworkACLItem {
public void setUuid(String uuid) { public void setUuid(String uuid) {
this.uuid = uuid; this.uuid = uuid;
} }
public void setDisplay(boolean display) {
this.display = display;
}
@Override
public boolean isDisplay() {
return display;
}
} }

View File

@ -47,6 +47,9 @@ public class NetworkACLVO implements NetworkACL {
@Column(name = "description") @Column(name = "description")
private String description; private String description;
@Column(name = "display", updatable = true, nullable = false)
protected boolean display = true;
public NetworkACLVO() { public NetworkACLVO() {
} }
@ -85,4 +88,13 @@ public class NetworkACLVO implements NetworkACL {
public void setUuid(String uuid) { public void setUuid(String uuid) {
this.uuid = uuid; this.uuid = uuid;
} }
public void setDisplay(boolean display) {
this.display = display;
}
@Override
public boolean isDisplay() {
return display;
}
} }

View File

@ -342,7 +342,7 @@ public class LoadBalanceRuleHandler {
lb.setSourceIpAddressId(ipId); lb.setSourceIpAddressId(ipId);
result = _lbMgr.createPublicLoadBalancer(lb.getXid(), lb.getName(), lb.getDescription(), lb.getSourcePortStart(), lb.getDefaultPortStart(), ipId.longValue(), result = _lbMgr.createPublicLoadBalancer(lb.getXid(), lb.getName(), lb.getDescription(), lb.getSourcePortStart(), lb.getDefaultPortStart(), ipId.longValue(),
lb.getProtocol(), lb.getAlgorithm(), false, CallContext.current(), lb.getLbProtocol()); lb.getProtocol(), lb.getAlgorithm(), false, CallContext.current(), lb.getLbProtocol(), true);
} catch (NetworkRuleConflictException e) { } catch (NetworkRuleConflictException e) {
s_logger.warn("Failed to create LB rule, not continuing with ELB deployment"); s_logger.warn("Failed to create LB rule, not continuing with ELB deployment");
if (newIp) { if (newIp) {

View File

@ -747,6 +747,7 @@ public class ApiResponseHelper implements ResponseGenerator {
lbResponse.setPrivatePort(Integer.toString(loadBalancer.getDefaultPortStart())); lbResponse.setPrivatePort(Integer.toString(loadBalancer.getDefaultPortStart()));
lbResponse.setAlgorithm(loadBalancer.getAlgorithm()); lbResponse.setAlgorithm(loadBalancer.getAlgorithm());
lbResponse.setLbProtocol(loadBalancer.getLbProtocol()); lbResponse.setLbProtocol(loadBalancer.getLbProtocol());
lbResponse.setForDisplay(loadBalancer.isDisplay());
FirewallRule.State state = loadBalancer.getState(); FirewallRule.State state = loadBalancer.getState();
String stateToSet = state.toString(); String stateToSet = state.toString();
if (state.equals(FirewallRule.State.Revoke)) { if (state.equals(FirewallRule.State.Revoke)) {
@ -2289,6 +2290,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setState(stateToSet); response.setState(stateToSet);
response.setNumber(aclItem.getNumber()); response.setNumber(aclItem.getNumber());
response.setAction(aclItem.getAction().toString()); response.setAction(aclItem.getAction().toString());
response.setForDisplay(aclItem.isDisplay());
NetworkACL acl = ApiDBUtils.findByNetworkACLId(aclItem.getAclId()); NetworkACL acl = ApiDBUtils.findByNetworkACLId(aclItem.getAclId());
if (acl != null) { if (acl != null) {
@ -3483,6 +3485,7 @@ public class ApiResponseHelper implements ResponseGenerator {
lbResponse.setName(lb.getName()); lbResponse.setName(lb.getName());
lbResponse.setDescription(lb.getDescription()); lbResponse.setDescription(lb.getDescription());
lbResponse.setAlgorithm(lb.getAlgorithm()); lbResponse.setAlgorithm(lb.getAlgorithm());
lbResponse.setForDisplay(lb.isDisplay());
Network nw = ApiDBUtils.findNetworkById(lb.getNetworkId()); Network nw = ApiDBUtils.findNetworkById(lb.getNetworkId());
lbResponse.setNetworkId(nw.getUuid()); lbResponse.setNetworkId(nw.getUuid());
populateOwner(lbResponse, lb); populateOwner(lbResponse, lb);
@ -3668,6 +3671,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setId(networkACL.getUuid()); response.setId(networkACL.getUuid());
response.setName(networkACL.getName()); response.setName(networkACL.getName());
response.setDescription(networkACL.getDescription()); response.setDescription(networkACL.getDescription());
response.setForDisplay(networkACL.isDisplay());
Vpc vpc = ApiDBUtils.findVpcById(networkACL.getVpcId()); Vpc vpc = ApiDBUtils.findVpcById(networkACL.getVpcId());
if (vpc != null) { if (vpc != null) {
response.setVpcId(vpc.getUuid()); response.setVpcId(vpc.getUuid());

View File

@ -1411,7 +1411,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
@Override @Override
@ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer") @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer")
public LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, public LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd,
Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException, Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol, Boolean forDisplay) throws NetworkRuleConflictException,
InsufficientAddressCapacityException { InsufficientAddressCapacityException {
Account lbOwner = _accountMgr.getAccount(lbOwnerId); Account lbOwner = _accountMgr.getAccount(lbOwnerId);
@ -1467,9 +1467,8 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
throw new InvalidParameterValueException("Ip address " + ipVO + " is not assigned to the network " + network); throw new InvalidParameterValueException("Ip address " + ipVO + " is not assigned to the network " + network);
} }
result = result = createPublicLoadBalancer(xId, name, description, srcPortStart, defPortStart, ipVO.getId(), protocol, algorithm, openFirewall, CallContext.current(),
createPublicLoadBalancer(xId, name, description, srcPortStart, defPortStart, ipVO.getId(), protocol, algorithm, openFirewall, CallContext.current(), lbProtocol, forDisplay);
lbProtocol);
} catch (Exception ex) { } catch (Exception ex) {
s_logger.warn("Failed to create load balancer due to ", ex); s_logger.warn("Failed to create load balancer due to ", ex);
if (ex instanceof NetworkRuleConflictException) { if (ex instanceof NetworkRuleConflictException) {
@ -1498,7 +1497,8 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
@DB @DB
@Override @Override
public LoadBalancer createPublicLoadBalancer(final String xId, final String name, final String description, final int srcPort, final int destPort, public LoadBalancer createPublicLoadBalancer(final String xId, final String name, final String description, final int srcPort, final int destPort,
final long sourceIpId, final String protocol, final String algorithm, final boolean openFirewall, final CallContext caller, final String lbProtocol) final long sourceIpId,
final String protocol, final String algorithm, final boolean openFirewall, final CallContext caller, final String lbProtocol, final Boolean forDisplay)
throws NetworkRuleConflictException { throws NetworkRuleConflictException {
if (!NetUtils.isValidPort(destPort)) { if (!NetUtils.isValidPort(destPort)) {
@ -1560,6 +1560,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
new LoadBalancerVO(xId, name, description, sourceIpId, srcPort, destPort, algorithm, networkId, ipAddr.getAllocatedToAccountId(), new LoadBalancerVO(xId, name, description, sourceIpId, srcPort, destPort, algorithm, networkId, ipAddr.getAllocatedToAccountId(),
ipAddr.getAllocatedInDomainId(), lbProtocol); ipAddr.getAllocatedInDomainId(), lbProtocol);
if (forDisplay != null) {
newRule.setDisplay(forDisplay);
}
// verify rule is supported by Lb provider of the network // verify rule is supported by Lb provider of the network
Ip sourceIp = getSourceIp(newRule); Ip sourceIp = getSourceIp(newRule);
LoadBalancingRule loadBalancing = LoadBalancingRule loadBalancing =
@ -1889,6 +1893,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
LoadBalancerVO lb = _lbDao.findById(lbRuleId); LoadBalancerVO lb = _lbDao.findById(lbRuleId);
LoadBalancerVO lbBackup = _lbDao.findById(lbRuleId); LoadBalancerVO lbBackup = _lbDao.findById(lbRuleId);
String customId = cmd.getCustomId(); String customId = cmd.getCustomId();
Boolean forDisplay = cmd.getDisplay();
if (lb == null) { if (lb == null) {
throw new InvalidParameterValueException("Unable to find lb rule by id=" + lbRuleId); throw new InvalidParameterValueException("Unable to find lb rule by id=" + lbRuleId);
@ -1913,6 +1918,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
lb.setUuid(customId); lb.setUuid(customId);
} }
if (forDisplay != null) {
lb.setDisplay(forDisplay);
}
boolean success = _lbDao.update(lbRuleId, lb); boolean success = _lbDao.update(lbRuleId, lb);
// If algorithm is changed, have to reapply the lb config // If algorithm is changed, have to reapply the lb config

View File

@ -84,8 +84,11 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
VpcService _vpcSvc; VpcService _vpcSvc;
@Override @Override
public NetworkACL createNetworkACL(String name, String description, long vpcId) { public NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay) {
NetworkACLVO acl = new NetworkACLVO(name, description, vpcId); NetworkACLVO acl = new NetworkACLVO(name, description, vpcId);
if (forDisplay != null) {
acl.setDisplay(forDisplay);
}
return _networkACLDao.persist(acl); return _networkACLDao.persist(acl);
} }
@ -215,8 +218,8 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
@Override @Override
@DB @DB
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_ACL_ITEM_CREATE, eventDescription = "creating network ACL Item", create = true) @ActionEvent(eventType = EventTypes.EVENT_NETWORK_ACL_ITEM_CREATE, eventDescription = "creating network ACL Item", create = true)
public NetworkACLItem createNetworkACLItem(final Integer portStart, final Integer portEnd, final String protocol, final List<String> sourceCidrList, public NetworkACLItem createNetworkACLItem(final Integer portStart, final Integer portEnd, final String protocol, final List<String> sourceCidrList, final Integer icmpCode,
final Integer icmpCode, final Integer icmpType, final NetworkACLItem.TrafficType trafficType, final Long aclId, final String action, Integer number) { final Integer icmpType, final NetworkACLItem.TrafficType trafficType, final Long aclId, final String action, Integer number, final Boolean forDisplay) {
// If number is null, set it to currentMax + 1 (for backward compatibility) // If number is null, set it to currentMax + 1 (for backward compatibility)
if (number == null) { if (number == null) {
number = _networkACLItemDao.getMaxNumberByACL(aclId) + 1; number = _networkACLItemDao.getMaxNumberByACL(aclId) + 1;
@ -233,6 +236,11 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
NetworkACLItemVO newRule = NetworkACLItemVO newRule =
new NetworkACLItemVO(portStart, portEnd, protocol.toLowerCase(), aclId, sourceCidrList, icmpCode, icmpType, trafficType, ruleAction, numberFinal); new NetworkACLItemVO(portStart, portEnd, protocol.toLowerCase(), aclId, sourceCidrList, icmpCode, icmpType, trafficType, ruleAction, numberFinal);
if (forDisplay != null) {
newRule.setDisplay(forDisplay);
}
newRule = _networkACLItemDao.persist(newRule); newRule = _networkACLItemDao.persist(newRule);
if (!_networkACLItemDao.setStateToAdd(newRule)) { if (!_networkACLItemDao.setStateToAdd(newRule)) {
@ -398,7 +406,7 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
@Override @Override
public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action,
Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId) throws ResourceUnavailableException { Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String customId, Boolean forDisplay) throws ResourceUnavailableException {
NetworkACLItemVO aclItem = _networkACLItemDao.findById(id); NetworkACLItemVO aclItem = _networkACLItemDao.findById(id);
aclItem.setState(State.Add); aclItem.setState(State.Add);
@ -446,6 +454,10 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
aclItem.setUuid(customId); aclItem.setUuid(customId);
} }
if (forDisplay != null) {
aclItem.setDisplay(forDisplay);
}
if (_networkACLItemDao.update(id, aclItem)) { if (_networkACLItemDao.update(id, aclItem)) {
if (applyNetworkACL(aclItem.getAclId())) { if (applyNetworkACL(aclItem.getAclId())) {
return aclItem; return aclItem;

View File

@ -96,14 +96,14 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
VpcService _vpcSvc; VpcService _vpcSvc;
@Override @Override
public NetworkACL createNetworkACL(String name, String description, long vpcId) { public NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay) {
Account caller = CallContext.current().getCallingAccount(); Account caller = CallContext.current().getCallingAccount();
Vpc vpc = _entityMgr.findById(Vpc.class, vpcId); Vpc vpc = _entityMgr.findById(Vpc.class, vpcId);
if (vpc == null) { if (vpc == null) {
throw new InvalidParameterValueException("Unable to find VPC"); throw new InvalidParameterValueException("Unable to find VPC");
} }
_accountMgr.checkAccess(caller, null, true, vpc); _accountMgr.checkAccess(caller, null, true, vpc);
return _networkAclMgr.createNetworkACL(name, description, vpcId); return _networkAclMgr.createNetworkACL(name, description, vpcId, forDisplay);
} }
@Override @Override
@ -329,7 +329,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
//Create new ACL //Create new ACL
String aclName = "VPC_" + vpc.getName() + "_Tier_" + network.getName() + "_ACL_" + network.getUuid(); String aclName = "VPC_" + vpc.getName() + "_Tier_" + network.getName() + "_ACL_" + network.getUuid();
String description = "ACL for " + aclName; String description = "ACL for " + aclName;
NetworkACL acl = _networkAclMgr.createNetworkACL(aclName, description, network.getVpcId()); NetworkACL acl = _networkAclMgr.createNetworkACL(aclName, description, network.getVpcId(), aclItemCmd.getDisplay());
if (acl == null) { if (acl == null) {
throw new CloudRuntimeException("Error while create ACL before adding ACL Item for network " + network.getId()); throw new CloudRuntimeException("Error while create ACL before adding ACL Item for network " + network.getId());
} }
@ -374,7 +374,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
return _networkAclMgr.createNetworkACLItem(aclItemCmd.getSourcePortStart(), aclItemCmd.getSourcePortEnd(), aclItemCmd.getProtocol(), return _networkAclMgr.createNetworkACLItem(aclItemCmd.getSourcePortStart(), aclItemCmd.getSourcePortEnd(), aclItemCmd.getProtocol(),
aclItemCmd.getSourceCidrList(), aclItemCmd.getIcmpCode(), aclItemCmd.getIcmpType(), aclItemCmd.getTrafficType(), aclId, aclItemCmd.getAction(), aclItemCmd.getSourceCidrList(), aclItemCmd.getIcmpCode(), aclItemCmd.getIcmpType(), aclItemCmd.getTrafficType(), aclId, aclItemCmd.getAction(),
aclItemCmd.getNumber()); aclItemCmd.getNumber(), aclItemCmd.getDisplay());
} }
private void validateNetworkACLItem(Integer portStart, Integer portEnd, List<String> sourceCidrList, String protocol, Integer icmpCode, Integer icmpType, private void validateNetworkACLItem(Integer portStart, Integer portEnd, List<String> sourceCidrList, String protocol, Integer icmpCode, Integer icmpType,
@ -607,7 +607,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
@Override @Override
public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action, public NetworkACLItem updateNetworkACLItem(Long id, String protocol, List<String> sourceCidrList, NetworkACLItem.TrafficType trafficType, String action,
Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID) throws ResourceUnavailableException { Integer number, Integer sourcePortStart, Integer sourcePortEnd, Integer icmpCode, Integer icmpType, String newUUID, Boolean forDisplay) throws ResourceUnavailableException {
NetworkACLItemVO aclItem = _networkACLItemDao.findById(id); NetworkACLItemVO aclItem = _networkACLItemDao.findById(id);
if (aclItem == null) { if (aclItem == null) {
throw new InvalidParameterValueException("Unable to find ACL Item cannot be found"); throw new InvalidParameterValueException("Unable to find ACL Item cannot be found");
@ -636,12 +636,12 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
validateNetworkACLItem((sourcePortStart == null) ? aclItem.getSourcePortStart() : sourcePortStart, (sourcePortEnd == null) ? aclItem.getSourcePortEnd() validateNetworkACLItem((sourcePortStart == null) ? aclItem.getSourcePortStart() : sourcePortStart, (sourcePortEnd == null) ? aclItem.getSourcePortEnd()
: sourcePortEnd, sourceCidrList, protocol, icmpCode, (icmpType == null) ? aclItem.getIcmpType() : icmpType, action, number); : sourcePortEnd, sourceCidrList, protocol, icmpCode, (icmpType == null) ? aclItem.getIcmpType() : icmpType, action, number);
return _networkAclMgr.updateNetworkACLItem(id, protocol, sourceCidrList, trafficType, action, number, sourcePortStart, sourcePortEnd, icmpCode, icmpType, newUUID); return _networkAclMgr.updateNetworkACLItem(id, protocol, sourceCidrList, trafficType, action, number, sourcePortStart, sourcePortEnd, icmpCode, icmpType, newUUID, forDisplay);
} }
@Override @Override
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_ACL_UPDATE, eventDescription = "updating network acl", async = true) @ActionEvent(eventType = EventTypes.EVENT_NETWORK_ACL_UPDATE, eventDescription = "updating network acl", async = true)
public NetworkACL updateNetworkACL(Long id, String customId) { public NetworkACL updateNetworkACL(Long id, String customId, Boolean forDisplay) {
NetworkACLVO acl = _networkACLDao.findById(id); NetworkACLVO acl = _networkACLDao.findById(id);
Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId()); Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId());
Account caller = CallContext.current().getCallingAccount(); Account caller = CallContext.current().getCallingAccount();
@ -651,6 +651,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
acl.setUuid(customId); acl.setUuid(customId);
} }
if (forDisplay != null) {
acl.setDisplay(forDisplay);
}
_networkACLDao.update(id, acl); _networkACLDao.update(id, acl);
return _networkACLDao.findById(id); return _networkACLDao.findById(id);
} }

View File

@ -104,7 +104,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
@Override @Override
@ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer") @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer")
public ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp, public ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp,
int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException, NetworkRuleConflictException, int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId, Boolean forDisplay) throws InsufficientAddressCapacityException, NetworkRuleConflictException,
InsufficientVirtualNetworkCapcityException { InsufficientVirtualNetworkCapcityException {
//Validate LB rule guest network //Validate LB rule guest network
@ -126,11 +126,11 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
throw new InvalidParameterValueException("Can't find the lb owner account"); throw new InvalidParameterValueException("Can't find the lb owner account");
} }
return createApplicationLoadBalancer(name, description, scheme, sourceIpNtwk, sourceIp, sourcePort, instancePort, algorithm, lbOwner, guestNtwk); return createApplicationLoadBalancer(name, description, scheme, sourceIpNtwk, sourceIp, sourcePort, instancePort, algorithm, lbOwner, guestNtwk, forDisplay);
} }
protected ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, Network sourceIpNtwk, String sourceIp, protected ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, Network sourceIpNtwk, String sourceIp,
int sourcePort, int instancePort, String algorithm, Account lbOwner, Network guestNtwk) throws NetworkRuleConflictException, int sourcePort, int instancePort, String algorithm, Account lbOwner, Network guestNtwk, Boolean forDisplay) throws NetworkRuleConflictException,
InsufficientVirtualNetworkCapcityException { InsufficientVirtualNetworkCapcityException {
//Only Internal scheme is supported in this release //Only Internal scheme is supported in this release
@ -151,6 +151,10 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
new ApplicationLoadBalancerRuleVO(name, description, sourcePort, instancePort, algorithm, guestNtwk.getId(), lbOwner.getId(), lbOwner.getDomainId(), new ApplicationLoadBalancerRuleVO(name, description, sourcePort, instancePort, algorithm, guestNtwk.getId(), lbOwner.getId(), lbOwner.getDomainId(),
sourceIpAddr, sourceIpNtwk.getId(), scheme); sourceIpAddr, sourceIpNtwk.getId(), scheme);
if (forDisplay != null) {
newRule.setDisplay(forDisplay);
}
//4) Validate Load Balancing rule on the providers //4) Validate Load Balancing rule on the providers
LoadBalancingRule loadBalancing = LoadBalancingRule loadBalancing =
new LoadBalancingRule(newRule, new ArrayList<LbDestination>(), new ArrayList<LbStickinessPolicy>(), new ArrayList<LbHealthCheckPolicy>(), sourceIpAddr, null, new LoadBalancingRule(newRule, new ArrayList<LbDestination>(), new ArrayList<LbStickinessPolicy>(), new ArrayList<LbHealthCheckPolicy>(), sourceIpAddr, null,
@ -527,7 +531,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
@Override @Override
@ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_UPDATE, eventDescription = "updating load balancer", async = true) @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_UPDATE, eventDescription = "updating load balancer", async = true)
public ApplicationLoadBalancerRule deleteApplicationLoadBalancer(Long id, String customId) { public ApplicationLoadBalancerRule updateApplicationLoadBalancer(Long id, String customId, Boolean forDisplay) {
Account caller = CallContext.current().getCallingAccount(); Account caller = CallContext.current().getCallingAccount();
ApplicationLoadBalancerRuleVO rule = _lbDao.findById(id); ApplicationLoadBalancerRuleVO rule = _lbDao.findById(id);
@ -535,9 +539,15 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
throw new InvalidParameterValueException("Unable to find load balancer " + id); throw new InvalidParameterValueException("Unable to find load balancer " + id);
} }
_accountMgr.checkAccess(caller, null, true, rule); _accountMgr.checkAccess(caller, null, true, rule);
if (customId != null) { if (customId != null) {
rule.setUuid(customId); rule.setUuid(customId);
} }
if (forDisplay != null) {
rule.setDisplay(forDisplay);
}
_lbDao.update(id, rule); _lbDao.update(id, rule);
return _lbDao.findById(id); return _lbDao.findById(id);

View File

@ -125,7 +125,7 @@ public class NetworkACLManagerTest extends TestCase {
@Test @Test
public void testCreateACL() throws Exception { public void testCreateACL() throws Exception {
Mockito.when(_networkACLDao.persist(Matchers.any(NetworkACLVO.class))).thenReturn(acl); Mockito.when(_networkACLDao.persist(Matchers.any(NetworkACLVO.class))).thenReturn(acl);
assertNotNull(_aclMgr.createNetworkACL("acl_new", "acl desc", 1L)); assertNotNull(_aclMgr.createNetworkACL("acl_new", "acl desc", 1L, true));
} }
@Test @Test
@ -227,7 +227,7 @@ public class NetworkACLManagerTest extends TestCase {
public void testUpdateACLItem() throws Exception { public void testUpdateACLItem() throws Exception {
Mockito.when(_networkACLItemDao.findById(Matchers.anyLong())).thenReturn(aclItem); Mockito.when(_networkACLItemDao.findById(Matchers.anyLong())).thenReturn(aclItem);
Mockito.when(_networkACLItemDao.update(Matchers.anyLong(), Matchers.any(NetworkACLItemVO.class))).thenReturn(true); Mockito.when(_networkACLItemDao.update(Matchers.anyLong(), Matchers.any(NetworkACLItemVO.class))).thenReturn(true);
assertNotNull(_aclMgr.updateNetworkACLItem(1L, "UDP", null, NetworkACLItem.TrafficType.Ingress, "Deny", 10, 22, 32, null, null, null)); assertNotNull(_aclMgr.updateNetworkACLItem(1L, "UDP", null, NetworkACLItem.TrafficType.Ingress, "Deny", 10, 22, 32, null, null, null, true));
} }
@Test(expected = CloudRuntimeException.class) @Test(expected = CloudRuntimeException.class)

View File

@ -22,6 +22,10 @@ import javax.inject.Inject;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.test.utils.SpringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -40,11 +44,6 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader; import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.test.utils.SpringUtils;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.NetworkModel; import com.cloud.network.NetworkModel;
import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkDao;
@ -155,8 +154,8 @@ public class NetworkACLServiceTest extends TestCase {
@Test @Test
public void testCreateACL() throws Exception { public void testCreateACL() throws Exception {
Mockito.when(_entityMgr.findById(Matchers.eq(Vpc.class), Matchers.anyLong())).thenReturn(new VpcVO()); Mockito.when(_entityMgr.findById(Matchers.eq(Vpc.class), Matchers.anyLong())).thenReturn(new VpcVO());
Mockito.when(_networkAclMgr.createNetworkACL("acl_new", "acl desc", 1L)).thenReturn(acl); Mockito.when(_networkAclMgr.createNetworkACL("acl_new", "acl desc", 1L, true)).thenReturn(acl);
assertNotNull(_aclService.createNetworkACL("acl_new", "acl desc", 1L)); assertNotNull(_aclService.createNetworkACL("acl_new", "acl desc", 1L, true));
} }
@Test(expected = InvalidParameterValueException.class) @Test(expected = InvalidParameterValueException.class)
@ -172,7 +171,7 @@ public class NetworkACLServiceTest extends TestCase {
Mockito.when(_networkAclMgr.getNetworkACL(Matchers.anyLong())).thenReturn(acl); Mockito.when(_networkAclMgr.getNetworkACL(Matchers.anyLong())).thenReturn(acl);
Mockito.when( Mockito.when(
_networkAclMgr.createNetworkACLItem(Matchers.anyInt(), Matchers.anyInt(), Matchers.anyString(), Matchers.anyList(), Matchers.anyInt(), Matchers.anyInt(), _networkAclMgr.createNetworkACLItem(Matchers.anyInt(), Matchers.anyInt(), Matchers.anyString(), Matchers.anyList(), Matchers.anyInt(), Matchers.anyInt(),
Matchers.any(NetworkACLItem.TrafficType.class), Matchers.anyLong(), Matchers.anyString(), Matchers.anyInt())).thenReturn(new NetworkACLItemVO()); Matchers.any(NetworkACLItem.TrafficType.class), Matchers.anyLong(), Matchers.anyString(), Matchers.anyInt(), true)).thenReturn(new NetworkACLItemVO());
Mockito.when(_networkACLItemDao.findByAclAndNumber(Matchers.anyLong(), Matchers.anyInt())).thenReturn(null); Mockito.when(_networkACLItemDao.findByAclAndNumber(Matchers.anyLong(), Matchers.anyInt())).thenReturn(null);
assertNotNull(_aclService.createNetworkACLItem(createACLItemCmd)); assertNotNull(_aclService.createNetworkACLItem(createACLItemCmd));
} }

View File

@ -244,7 +244,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public public
void createValidLoadBalancer() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { void createValidLoadBalancer() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId, _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId,
validAccountId); validAccountId, true);
} }
@Test(expected = UnsupportedServiceException.class) @Test(expected = UnsupportedServiceException.class)
@ -252,7 +252,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public public
void createPublicLoadBalancer() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { void createPublicLoadBalancer() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Public, validGuestNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId, _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Public, validGuestNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId,
validAccountId); validAccountId, true);
} }
@Test(expected = InvalidParameterValueException.class) @Test(expected = InvalidParameterValueException.class)
@ -260,7 +260,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public public
void createWithInvalidSourcePort() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { void createWithInvalidSourcePort() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 65536, 22, "roundrobin", validGuestNetworkId, _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 65536, 22, "roundrobin", validGuestNetworkId,
validAccountId); validAccountId, true);
} }
@Test(expected = InvalidParameterValueException.class) @Test(expected = InvalidParameterValueException.class)
@ -268,7 +268,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public public
void createWithInvalidInstandePort() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { void createWithInvalidInstandePort() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 65536, "roundrobin", validGuestNetworkId, _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 65536, "roundrobin", validGuestNetworkId,
validAccountId); validAccountId, true);
} }
@ -278,7 +278,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
void createWithInvalidAlgorithm() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { void createWithInvalidAlgorithm() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
String expectedExcText = null; String expectedExcText = null;
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 22, "invalidalgorithm", _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 22, "invalidalgorithm",
validGuestNetworkId, validAccountId); validGuestNetworkId, validAccountId, true);
} }
@ -287,7 +287,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public public
void createWithInvalidSourceIpNtwk() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { void createWithInvalidSourceIpNtwk() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validPublicNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId, _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validPublicNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId,
validAccountId); validAccountId, true);
} }
@ -297,7 +297,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
void createWithInvalidRequestedIp() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException { void createWithInvalidRequestedIp() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, "10.2.1.1", 22, 22, "roundrobin", validGuestNetworkId, _appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, "10.2.1.1", 22, 22, "roundrobin", validGuestNetworkId,
validAccountId); validAccountId, true);
} }
private static NetworkVO setId(NetworkVO vo, long id) { private static NetworkVO setId(NetworkVO vo, long id) {

View File

@ -534,6 +534,8 @@ ALTER TABLE `cloud`.`vpc` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' C
ALTER TABLE `cloud`.`firewall_rules` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the rule can be displayed to the end user'; ALTER TABLE `cloud`.`firewall_rules` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the rule can be displayed to the end user';
ALTER TABLE `cloud`.`autoscale_vmgroups` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the entry can be displayed to the end user'; ALTER TABLE `cloud`.`autoscale_vmgroups` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the entry can be displayed to the end user';
ALTER TABLE `cloud`.`autoscale_vmprofiles` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the entry can be displayed to the end user'; ALTER TABLE `cloud`.`autoscale_vmprofiles` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the entry can be displayed to the end user';
ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the entry can be displayed to the end user';
ALTER TABLE `cloud`.`network_acl` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the entry can be displayed to the end user';