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));
}
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();
}
Aggregations