Search in sources :

Example 1 with NetworkACLServiceProvider

use of com.cloud.network.element.NetworkACLServiceProvider in project cloudstack by apache.

the class NetworkACLManagerImpl method applyACLItemsToNetwork.

public boolean applyACLItemsToNetwork(final long networkId, final List<NetworkACLItemVO> rules) throws ResourceUnavailableException {
    final Network network = _networkDao.findById(networkId);
    boolean handled = false;
    boolean foundProvider = false;
    for (final NetworkACLServiceProvider element : _networkAclElements) {
        final Network.Provider provider = element.getProvider();
        final 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) {
            // publish message on message bus, so that network elements implementing distributed routing
            // capability can act on the event
            _messageBus.publish(_name, "Network_ACL_Replaced", PublishScope.LOCAL, network);
            break;
        }
    }
    if (!foundProvider) {
        s_logger.debug("Unable to find NetworkACL service provider for network: " + network.getId());
    }
    return handled;
}
Also used : Network(com.cloud.network.Network) NetworkACLServiceProvider(com.cloud.network.element.NetworkACLServiceProvider)

Aggregations

Network (com.cloud.network.Network)1 NetworkACLServiceProvider (com.cloud.network.element.NetworkACLServiceProvider)1