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 {
/**
* Create a load balancer rule from the given ipAddress/port to the given private port
*
* @param openFirewall
* TODO
* @param forDisplay TODO
* @param cmd
* the command specifying the ip address, public port, protocol, private port, and algorithm
*
* @return the newly created LoadBalancerVO if successful, null otherwise
* @throws InsufficientAddressCapacityException
*/
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;
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);

View File

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

View File

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

View File

@ -31,9 +31,10 @@ public interface NetworkACLService {
* @param name
* @param description
* @param vpcId
* @param forDisplay TODO
* @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
@ -115,11 +116,12 @@ public interface NetworkACLService {
* @param icmpCode
* @param icmpType
* @param newUUID TODO
* @param forDisplay TODO
* @return
* @throws ResourceUnavailableException
*/
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
@ -130,6 +132,6 @@ public interface NetworkACLService {
*/
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 ///////////////////////
// ///////////////////////////////////////////////////
public Long getIpAddressId() {
return ipAddressId;
}

View File

@ -16,8 +16,7 @@
// under the License.
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.ApiCommandJobType;
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.context.CallContext;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
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")
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 ///////////////////////
/////////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
}
public String getAlgorithm() {
return algorithm;
@ -215,7 +221,7 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd {
ApplicationLoadBalancerRule result =
_appLbService.createApplicationLoadBalancer(getName(), getDescription(), getScheme(), getSourceIpNetworkId(), getSourceIp(), getSourcePort(),
getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId());
getInstancePort(), getAlgorithm(), getNetworkId(), getEntityOwnerId(), getDisplay());
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {

View File

@ -18,8 +18,7 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
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.ApiCommandJobType;
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.ZoneResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.dc.DataCenter;
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")
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 ///////////////////////
/////////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
}
public String getAlgorithm() {
return algorithm;
}
@ -301,7 +308,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L
try {
LoadBalancer result =
_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.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {

View File

@ -16,6 +16,7 @@
// under the License.
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.ApiConstants;
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")
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 ///////////////////////
/////////////////////////////////////////////////////
@ -54,6 +58,10 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd {
return id;
}
public Boolean getDisplay() {
return display;
}
@Override
public long getEntityOwnerId() {
ApplicationLoadBalancerRule lb = _entityMgr.findById(ApplicationLoadBalancerRule.class, getId());
@ -81,7 +89,7 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd {
@Override
public void execute() {
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()));
setResponseObject(lbResponse);
lbResponse.setResponseName(getCommandName());

View File

@ -16,6 +16,7 @@
// under the License.
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.ApiConstants;
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")
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 ///////////////////////
/////////////////////////////////////////////////////
@ -79,6 +83,10 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd {
return loadBalancerName;
}
public Boolean getDisplay() {
return display;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -19,9 +19,7 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
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.NetworkResponse;
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.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")
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 ///////////////////////
// ///////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
}
public String getProtocol() {
String p = protocol.trim();

View File

@ -16,8 +16,7 @@
// under the License.
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.ApiConstants;
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.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
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")
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 ///////////////////////
// ///////////////////////////////////////////////////
@ -73,6 +76,10 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
return vpcId;
}
public Boolean getDisplay() {
return display;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@ -84,7 +91,7 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
@Override
public void create() {
NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId());
NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId(), getDisplay());
setEntityId(result.getId());
setEntityUuid(result.getUuid());
}

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.List;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
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")
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 ///////////////////////
// ///////////////////////////////////////////////////
public Boolean getDisplay() {
return display;
}
public Long getId() {
return id;
@ -164,7 +171,7 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
CallContext.current().setEventDetails("Rule Id: " + getId());
NetworkACLItem aclItem =
_networkACLService.updateNetworkACLItem(getId(), getProtocol(), getSourceCidrList(), getTrafficType(), getAction(), getNumber(), getSourcePortStart(),
getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId());
getSourcePortEnd(), getIcmpCode(), getIcmpType(), this.getCustomId(), this.getDisplay());
if (aclItem == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network ACL Item");
}

View File

@ -16,6 +16,7 @@
// under the License.
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.ApiConstants;
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")
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 ///////////////////////
/////////////////////////////////////////////////////
@ -50,6 +54,10 @@ public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd {
return id;
}
public Boolean getDisplay() {
return display;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -76,7 +84,7 @@ public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd {
@Override
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);
setResponseObject(aclResponse);
aclResponse.setResponseName(getCommandName());

View File

@ -16,12 +16,11 @@
// under the License.
package org.apache.cloudstack.api.response;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
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 com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
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)
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
public void setAccountName(String accountName) {
this.accountName = accountName;
@ -152,4 +156,8 @@ public class ApplicationLoadBalancerResponse extends BaseResponse implements Con
public void setLbInstances(List<ApplicationLoadBalancerInstanceResponse> 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 com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
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)
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) {
this.id = id;
}
@ -183,4 +187,8 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
public void setLbProtocol(String 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 com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = NetworkACLItem.class)
public class NetworkACLItemResponse extends BaseResponse {
@ -81,6 +81,10 @@ public class NetworkACLItemResponse extends BaseResponse {
@Param(description = "Action of ACL Item. Allow/Deny")
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) {
this.id = id;
}
@ -132,4 +136,8 @@ public class NetworkACLItemResponse extends BaseResponse {
public void setAction(String action) {
this.action = action;
}
public void setForDisplay(Boolean forDisplay) {
this.forDisplay = forDisplay;
}
}

View File

@ -16,14 +16,14 @@
// under the License.
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.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import com.cloud.network.vpc.NetworkACL;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = NetworkACL.class)
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")
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) {
this.id = id;
}
@ -58,4 +62,8 @@ public class NetworkACLResponse extends BaseResponse {
public void setVpcId(String 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 {
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;
boolean deleteApplicationLoadBalancer(long id);
@ -39,6 +39,6 @@ public interface ApplicationLoadBalancerService {
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 {
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);

View File

@ -28,9 +28,10 @@ public interface NetworkACLManager {
* @param name
* @param description
* @param vpcId
* @param forDisplay TODO
* @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
@ -74,10 +75,11 @@ public interface NetworkACLManager {
* @param aclId
* @param action
* @param number
* @param forDisplay TODO
* @return
*/
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
@ -131,11 +133,12 @@ public interface NetworkACLManager {
* @param icmpCode
* @param icmpType
* @param customId TODO
* @param forDisplay TODO
* @return
* @throws ResourceUnavailableException
*/
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

View File

@ -84,6 +84,9 @@ public class NetworkACLItemVO implements NetworkACLItem {
@Enumerated(value = EnumType.STRING)
Action action;
@Column(name = "display", updatable = true, nullable = false)
protected boolean display = true;
public NetworkACLItemVO() {
this.uuid = UUID.randomUUID().toString();
}
@ -245,4 +248,13 @@ public class NetworkACLItemVO implements NetworkACLItem {
public void setUuid(String 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")
private String description;
@Column(name = "display", updatable = true, nullable = false)
protected boolean display = true;
public NetworkACLVO() {
}
@ -85,4 +88,13 @@ public class NetworkACLVO implements NetworkACL {
public void setUuid(String 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);
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) {
s_logger.warn("Failed to create LB rule, not continuing with ELB deployment");
if (newIp) {

View File

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

View File

@ -1411,7 +1411,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
@Override
@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,
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 {
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);
}
result =
createPublicLoadBalancer(xId, name, description, srcPortStart, defPortStart, ipVO.getId(), protocol, algorithm, openFirewall, CallContext.current(),
lbProtocol);
result = createPublicLoadBalancer(xId, name, description, srcPortStart, defPortStart, ipVO.getId(), protocol, algorithm, openFirewall, CallContext.current(),
lbProtocol, forDisplay);
} catch (Exception ex) {
s_logger.warn("Failed to create load balancer due to ", ex);
if (ex instanceof NetworkRuleConflictException) {
@ -1498,7 +1497,8 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
@DB
@Override
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 {
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(),
ipAddr.getAllocatedInDomainId(), lbProtocol);
if (forDisplay != null) {
newRule.setDisplay(forDisplay);
}
// verify rule is supported by Lb provider of the network
Ip sourceIp = getSourceIp(newRule);
LoadBalancingRule loadBalancing =
@ -1889,6 +1893,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
LoadBalancerVO lb = _lbDao.findById(lbRuleId);
LoadBalancerVO lbBackup = _lbDao.findById(lbRuleId);
String customId = cmd.getCustomId();
Boolean forDisplay = cmd.getDisplay();
if (lb == null) {
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);
}
if (forDisplay != null) {
lb.setDisplay(forDisplay);
}
boolean success = _lbDao.update(lbRuleId, lb);
// 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;
@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);
if (forDisplay != null) {
acl.setDisplay(forDisplay);
}
return _networkACLDao.persist(acl);
}
@ -215,8 +218,8 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
@Override
@DB
@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,
final Integer icmpCode, final Integer icmpType, final NetworkACLItem.TrafficType trafficType, final Long aclId, final String action, Integer number) {
public NetworkACLItem createNetworkACLItem(final Integer portStart, final Integer portEnd, final String protocol, final List<String> sourceCidrList, final Integer icmpCode,
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 == null) {
number = _networkACLItemDao.getMaxNumberByACL(aclId) + 1;
@ -233,6 +236,11 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
NetworkACLItemVO newRule =
new NetworkACLItemVO(portStart, portEnd, protocol.toLowerCase(), aclId, sourceCidrList, icmpCode, icmpType, trafficType, ruleAction, numberFinal);
if (forDisplay != null) {
newRule.setDisplay(forDisplay);
}
newRule = _networkACLItemDao.persist(newRule);
if (!_networkACLItemDao.setStateToAdd(newRule)) {
@ -398,7 +406,7 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
@Override
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);
aclItem.setState(State.Add);
@ -446,6 +454,10 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
aclItem.setUuid(customId);
}
if (forDisplay != null) {
aclItem.setDisplay(forDisplay);
}
if (_networkACLItemDao.update(id, aclItem)) {
if (applyNetworkACL(aclItem.getAclId())) {
return aclItem;

View File

@ -96,14 +96,14 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
VpcService _vpcSvc;
@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();
Vpc vpc = _entityMgr.findById(Vpc.class, vpcId);
if (vpc == null) {
throw new InvalidParameterValueException("Unable to find VPC");
}
_accountMgr.checkAccess(caller, null, true, vpc);
return _networkAclMgr.createNetworkACL(name, description, vpcId);
return _networkAclMgr.createNetworkACL(name, description, vpcId, forDisplay);
}
@Override
@ -329,7 +329,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
//Create new ACL
String aclName = "VPC_" + vpc.getName() + "_Tier_" + network.getName() + "_ACL_" + network.getUuid();
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) {
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(),
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,
@ -607,7 +607,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
@Override
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);
if (aclItem == null) {
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()
: 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
@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);
Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId());
Account caller = CallContext.current().getCallingAccount();
@ -651,6 +651,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
acl.setUuid(customId);
}
if (forDisplay != null) {
acl.setDisplay(forDisplay);
}
_networkACLDao.update(id, acl);
return _networkACLDao.findById(id);
}

View File

@ -104,7 +104,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
@Override
@ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating load balancer")
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 {
//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");
}
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,
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 {
//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(),
sourceIpAddr, sourceIpNtwk.getId(), scheme);
if (forDisplay != null) {
newRule.setDisplay(forDisplay);
}
//4) Validate Load Balancing rule on the providers
LoadBalancingRule loadBalancing =
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
@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();
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);
}
_accountMgr.checkAccess(caller, null, true, rule);
if (customId != null) {
rule.setUuid(customId);
}
if (forDisplay != null) {
rule.setDisplay(forDisplay);
}
_lbDao.update(id, rule);
return _lbDao.findById(id);

View File

@ -125,7 +125,7 @@ public class NetworkACLManagerTest extends TestCase {
@Test
public void testCreateACL() throws Exception {
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
@ -227,7 +227,7 @@ public class NetworkACLManagerTest extends TestCase {
public void testUpdateACLItem() throws Exception {
Mockito.when(_networkACLItemDao.findById(Matchers.anyLong())).thenReturn(aclItem);
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)

View File

@ -22,6 +22,10 @@ import javax.inject.Inject;
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.junit.After;
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.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.network.NetworkModel;
import com.cloud.network.dao.NetworkDao;
@ -155,8 +154,8 @@ public class NetworkACLServiceTest extends TestCase {
@Test
public void testCreateACL() throws Exception {
Mockito.when(_entityMgr.findById(Matchers.eq(Vpc.class), Matchers.anyLong())).thenReturn(new VpcVO());
Mockito.when(_networkAclMgr.createNetworkACL("acl_new", "acl desc", 1L)).thenReturn(acl);
assertNotNull(_aclService.createNetworkACL("acl_new", "acl desc", 1L));
Mockito.when(_networkAclMgr.createNetworkACL("acl_new", "acl desc", 1L, true)).thenReturn(acl);
assertNotNull(_aclService.createNetworkACL("acl_new", "acl desc", 1L, true));
}
@Test(expected = InvalidParameterValueException.class)
@ -172,7 +171,7 @@ public class NetworkACLServiceTest extends TestCase {
Mockito.when(_networkAclMgr.getNetworkACL(Matchers.anyLong())).thenReturn(acl);
Mockito.when(
_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);
assertNotNull(_aclService.createNetworkACLItem(createACLItemCmd));
}

View File

@ -244,7 +244,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public
void createValidLoadBalancer() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId,
validAccountId);
validAccountId, true);
}
@Test(expected = UnsupportedServiceException.class)
@ -252,7 +252,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public
void createPublicLoadBalancer() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Public, validGuestNetworkId, validRequestedIp, 22, 22, "roundrobin", validGuestNetworkId,
validAccountId);
validAccountId, true);
}
@Test(expected = InvalidParameterValueException.class)
@ -260,7 +260,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public
void createWithInvalidSourcePort() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_appLbSvc.createApplicationLoadBalancer("alena", "alena", Scheme.Internal, validGuestNetworkId, validRequestedIp, 65536, 22, "roundrobin", validGuestNetworkId,
validAccountId);
validAccountId, true);
}
@Test(expected = InvalidParameterValueException.class)
@ -268,7 +268,7 @@ public class ApplicationLoadBalancerTest extends TestCase {
public
void createWithInvalidInstandePort() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_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 {
String expectedExcText = null;
_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
void createWithInvalidSourceIpNtwk() throws InsufficientAddressCapacityException, InsufficientVirtualNetworkCapcityException, NetworkRuleConflictException {
_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 {
_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) {

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`.`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`.`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';