Search in sources :

Example 1 with SecurityRuleAttr

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr in project netvirt by opendaylight.

the class AbstractAclServiceImpl method programAceRule.

/**
 * Programs the ace specific rule.
 *
 * @param port acl interface
 * @param aclName the acl name
 * @param ace rule to be program
 * @param addOrRemove whether to delete or add flow
 */
protected void programAceRule(AclInterface port, String aclName, Ace ace, int addOrRemove) {
    SecurityRuleAttr aceAttr = AclServiceUtils.getAccesssListAttributes(ace);
    if (!isValidDirection(aceAttr.getDirection())) {
        LOG.trace("Ignoring {} direction while processing for {} ACE Rule {}", aceAttr.getDirection(), this.directionString, ace.getRuleName());
        return;
    }
    LOG.debug("Program {} ACE rule for dpId={}, lportTag={}, addOrRemove={}, ace={}, portId={}", this.directionString, port.getDpId(), port.getLPortTag(), addOrRemove, ace.getRuleName(), port.getInterfaceId());
    Matches matches = ace.getMatches();
    Map<String, List<MatchInfoBase>> flowMap = null;
    if (matches.getAceType() instanceof AceIp) {
        flowMap = AclServiceOFFlowBuilder.programIpFlow(matches);
        if (!AclServiceUtils.doesAceHaveRemoteGroupId(aceAttr)) {
            // programming for ACE which doesn't have any remote group Id
            programForAceNotHavingRemoteAclId(port, aclName, ace, flowMap, addOrRemove);
        } else {
            Uuid remoteAclId = aceAttr.getRemoteGroupId();
            // programming for ACE which have remote group Id
            programAceSpecificFlows(port, aclName, ace, flowMap, remoteAclId, addOrRemove);
        }
    }
}
Also used : SecurityRuleAttr(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Matches(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches) AceIp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with SecurityRuleAttr

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr 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

Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)2 SecurityRuleAttr (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 AccessListEntries (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.AccessListEntries)1 Ace (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace)1 Matches (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches)1 AceIp (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp)1