Ejemplo n.º 1
0
 @Override
 public List<NetworkACLItemVO> listNetworkACLItems(long guestNtwkId) {
   Network network = _networkMgr.getNetwork(guestNtwkId);
   if (network.getNetworkACLId() == null) {
     return null;
   }
   return _networkACLItemDao.listByACL(network.getNetworkACLId());
 }
Ejemplo n.º 2
0
 @Override
 public boolean applyACLToNetwork(long networkId) throws ResourceUnavailableException {
   Network network = _networkDao.findById(networkId);
   if (network.getNetworkACLId() == null) {
     return true;
   }
   List<NetworkACLItemVO> rules = _networkACLItemDao.listByACL(network.getNetworkACLId());
   return applyACLItemsToNetwork(networkId, rules);
 }
Ejemplo n.º 3
0
  @Override
  public boolean revokeACLItemsForNetwork(long networkId) throws ResourceUnavailableException {
    Network network = _networkDao.findById(networkId);
    if (network.getNetworkACLId() == null) {
      return true;
    }
    List<NetworkACLItemVO> aclItems = _networkACLItemDao.listByACL(network.getNetworkACLId());
    if (aclItems.isEmpty()) {
      s_logger.debug("Found no network ACL Items for network id=" + networkId);
      return true;
    }

    if (s_logger.isDebugEnabled()) {
      s_logger.debug(
          "Releasing " + aclItems.size() + " Network ACL Items for network id=" + networkId);
    }

    for (NetworkACLItemVO aclItem : aclItems) {
      // Mark all Network ACLs rules as Revoke, but don't update in DB
      if (aclItem.getState() == State.Add || aclItem.getState() == State.Active) {
        aclItem.setState(State.Revoke);
      }
    }

    boolean success = applyACLItemsToNetwork(network.getId(), aclItems);

    if (s_logger.isDebugEnabled() && success) {
      s_logger.debug(
          "Successfully released Network ACLs for network id="
              + networkId
              + " and # of rules now = "
              + aclItems.size());
    }

    return success;
  }