Search in sources :

Example 1 with SetPolicyClassifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.SetPolicyClassifier in project netvirt by opendaylight.

the class PolicyServiceUtil method getAcePolicyClassifier.

public Optional<String> getAcePolicyClassifier(Ace ace) {
    Actions actions = ace.getActions();
    SetPolicyClassifier setPolicyClassifier = actions.getAugmentation(SetPolicyClassifier.class);
    if (setPolicyClassifier == null) {
        LOG.warn("No valid policy action found for ACE rule {}", ace.getRuleName());
        return Optional.absent();
    }
    Class<? extends DirectionBase> direction;
    try {
        direction = setPolicyClassifier.getDirection();
    } catch (IllegalArgumentException e) {
        LOG.warn("Failed to parse policy classifier direction");
        return Optional.absent();
    }
    if (direction == null || !direction.isAssignableFrom(DirectionEgress.class)) {
        LOG.trace("Ignoring non egress policy ACE rule {}", ace.getRuleName());
        return Optional.absent();
    }
    return Optional.of(setPolicyClassifier.getPolicyClassifier());
}
Also used : Actions(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Actions) SetPolicyClassifier(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.SetPolicyClassifier)

Aggregations

Actions (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Actions)1 SetPolicyClassifier (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.SetPolicyClassifier)1