Search in sources :

Example 1 with IngressInterface

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

the class PolicyAceFlowProgrammer method getIngressInterfaceFlow.

private Optional<PolicyAceFlowWrapper> getIngressInterfaceFlow(IngressInterface ingressInterface) {
    String interfaceName = ingressInterface.getName();
    if (interfaceName == null) {
        LOG.error("Invalid ingress interface augmentation. missing interface name");
        return Optional.absent();
    }
    String flowName = "INGRESS_INTERFACE_" + interfaceName;
    int flowPriority = PolicyServiceConstants.POLICY_ACL_TRUNK_INTERFACE_FLOW_PRIOPITY;
    VlanId vlanId = ingressInterface.getVlanId();
    if (vlanId != null) {
        Optional<String> vlanMemberInterfaceOpt = policyServiceUtil.getVlanMemberInterface(interfaceName, vlanId);
        if (!vlanMemberInterfaceOpt.isPresent()) {
            LOG.debug("Vlan member {} missing for trunk {}", vlanId.getValue(), interfaceName);
            return Optional.of(new PolicyAceFlowWrapper(flowName, PolicyAceFlowWrapper.PARTIAL));
        }
        interfaceName = vlanMemberInterfaceOpt.get();
        flowPriority = PolicyServiceConstants.POLICY_ACL_VLAN_INTERFACE_FLOW_PRIOPITY;
    }
    List<MatchInfoBase> matches = policyFlowUtil.getIngressInterfaceMatches(interfaceName);
    if (matches == null || matches.isEmpty()) {
        LOG.debug("Failed to get ingress interface {} matches", interfaceName);
        return Optional.of(new PolicyAceFlowWrapper(flowName, PolicyAceFlowWrapper.PARTIAL));
    }
    BigInteger dpId = interfaceManager.getDpnForInterface(interfaceName);
    if (dpId == null) {
        dpId = BigInteger.ZERO;
    }
    return Optional.of(new PolicyAceFlowWrapper(flowName, matches, flowPriority, dpId));
}
Also used : BigInteger(java.math.BigInteger) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Example 2 with IngressInterface

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

the class PolicyAceFlowProgrammer method getPolicyAceFlowWrapper.

private Optional<PolicyAceFlowWrapper> getPolicyAceFlowWrapper(Matches matches) {
    IngressInterface ingressInterface = matches.getAugmentation(IngressInterface.class);
    if (ingressInterface != null) {
        Optional<PolicyAceFlowWrapper> interfaceFlowOpt = getIngressInterfaceFlow(ingressInterface);
        if (interfaceFlowOpt.isPresent()) {
            return interfaceFlowOpt;
        }
    }
    Service service = matches.getAugmentation(Service.class);
    if (service != null) {
        Optional<PolicyAceFlowWrapper> serviceFlowOpt = getPolicyServiceFlow(service);
        if (serviceFlowOpt.isPresent()) {
            return serviceFlowOpt;
        }
    }
    return Optional.absent();
}
Also used : IngressInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.IngressInterface) Service(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service)

Aggregations

BigInteger (java.math.BigInteger)1 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)1 VlanId (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId)1 IngressInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.IngressInterface)1 Service (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service)1