Search in sources :

Example 1 with AccessListEntries

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.AccessListEntries in project netvirt by opendaylight.

the class AbstractAclServiceImpl method programAclRules.

/**
 * Programs the acl custom rules.
 *
 * @param port acl interface
 * @param aclUuidList the list of acl uuid to be applied
 * @param addOrRemove whether to delete or add flow
 * @return program succeeded
 */
protected boolean programAclRules(AclInterface port, List<Uuid> aclUuidList, int addOrRemove) {
    BigInteger dpId = port.getDpId();
    LOG.debug("Applying custom rules on DpId {}, lportTag {}", dpId, port.getLPortTag());
    if (aclUuidList == null || dpId == null) {
        LOG.warn("{} ACL parameters can not be null. dpId={}, aclUuidList={}", this.directionString, dpId, aclUuidList);
        return false;
    }
    for (Uuid aclUuid : aclUuidList) {
        Acl acl = this.aclDataUtil.getAcl(aclUuid.getValue());
        if (null == acl) {
            LOG.warn("The ACL {} not found in cache", aclUuid.getValue());
            continue;
        }
        AccessListEntries accessListEntries = acl.getAccessListEntries();
        List<Ace> aceList = accessListEntries.getAce();
        for (Ace ace : aceList) {
            programAceRule(port, aclUuid.getValue(), ace, addOrRemove);
        }
    }
    return true;
}
Also used : Ace(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) BigInteger(java.math.BigInteger) Acl(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl) AccessListEntries(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.AccessListEntries)

Example 2 with AccessListEntries

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.AccessListEntries in project netvirt by opendaylight.

the class AclServiceUtils method getRemoteAclIdsByDirection.

public static Set<Uuid> getRemoteAclIdsByDirection(Acl acl, Class<? extends DirectionBase> direction) {
    Set<Uuid> remoteAclIds = new HashSet<>();
    AccessListEntries accessListEntries = acl.getAccessListEntries();
    if (accessListEntries != null && accessListEntries.getAce() != null) {
        for (Ace ace : accessListEntries.getAce()) {
            SecurityRuleAttr aceAttr = AclServiceUtils.getAccesssListAttributes(ace);
            if (aceAttr.getDirection().equals(direction) && doesAceHaveRemoteGroupId(aceAttr)) {
                remoteAclIds.add(aceAttr.getRemoteGroupId());
            }
        }
    }
    return remoteAclIds;
}
Also used : Ace(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) SecurityRuleAttr(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr) AccessListEntries(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.AccessListEntries) HashSet(java.util.HashSet)

Aggregations

AccessListEntries (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.AccessListEntries)2 Ace (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace)2 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)2 BigInteger (java.math.BigInteger)1 HashSet (java.util.HashSet)1 Acl (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl)1 SecurityRuleAttr (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr)1