Added networkAclId to listNetworkResponse. Log ACL provider while applying network ACLs

This commit is contained in:
Kishan Kavala 2013-05-30 16:34:49 +05:30
parent 4b8bacd98a
commit 3115ddf007
3 changed files with 25 additions and 0 deletions

View File

@ -166,6 +166,10 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
@SerializedName(ApiConstants.DISPLAY_NETWORK) @Param(description="an optional field, whether to the display the network to the end user or not.")
private Boolean displayNetwork;
@SerializedName(ApiConstants.ACL_ID) @Param(description="ACL Id associated with the VPC network")
private String aclId;
public Boolean getDisplayNetwork() {
return displayNetwork;
}
@ -352,4 +356,12 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
public void setIp6Cidr(String ip6Cidr) {
this.ip6Cidr = ip6Cidr;
}
public String getAclId() {
return aclId;
}
public void setAclId(String aclId) {
this.aclId = aclId;
}
}

View File

@ -2489,6 +2489,13 @@ public class ApiResponseHelper implements ResponseGenerator {
}
response.setTags(tagResponses);
if(network.getNetworkACLId() != null){
NetworkACL acl = ApiDBUtils.findByNetworkACLId(network.getNetworkACLId());
if(acl != null){
response.setAclId(acl.getUuid());
}
}
response.setObjectName("network");
return response;
}

View File

@ -376,16 +376,22 @@ public class NetworkACLManagerImpl extends ManagerBase implements NetworkACLMana
public boolean applyACLItemsToNetwork(long networkId, List<NetworkACLItemVO> rules) throws ResourceUnavailableException {
Network network = _networkDao.findById(networkId);
boolean handled = false;
boolean foundProvider = false;
for (NetworkACLServiceProvider element: _networkAclElements) {
Network.Provider provider = element.getProvider();
boolean isAclProvider = _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.NetworkACL, provider);
if (!isAclProvider) {
continue;
}
foundProvider = true;
s_logger.debug("Applying NetworkACL for network: "+network.getId()+" with Network ACL service provider");
handled = element.applyNetworkACLs(network, rules);
if (handled)
break;
}
if(!foundProvider){
s_logger.debug("Unable to find NetworkACL service provider for network: "+network.getId());
}
return handled;
}