Search in sources :

Example 1 with MatchArpSpa

use of org.opendaylight.genius.mdsalutil.matches.MatchArpSpa in project netvirt by opendaylight.

the class AclServiceUtils method buildArpIpMatches.

/**
 * Builds the arp ip matches.
 * @param ipPrefixOrAddress the ip prefix or address
 * @return the MatchInfoBase list
 */
public static List<MatchInfoBase> buildArpIpMatches(IpPrefixOrAddress ipPrefixOrAddress) {
    List<MatchInfoBase> flowMatches = new ArrayList<>();
    IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
    if (ipPrefix != null) {
        Ipv4Prefix ipv4Prefix = ipPrefix.getIpv4Prefix();
        if (ipv4Prefix != null && !ipv4Prefix.getValue().equals(AclConstants.IPV4_ALL_NETWORK)) {
            flowMatches.add(new MatchArpSpa(ipv4Prefix));
        }
    } else {
        IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
        if (ipAddress != null && ipAddress.getIpv4Address() != null) {
            flowMatches.add(new MatchArpSpa(ipAddress.getIpv4Address().getValue(), "32"));
        }
    }
    return flowMatches;
}
Also used : IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) ArrayList(java.util.ArrayList) MatchArpSpa(org.opendaylight.genius.mdsalutil.matches.MatchArpSpa) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Aggregations

ArrayList (java.util.ArrayList)1 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)1 MatchArpSpa (org.opendaylight.genius.mdsalutil.matches.MatchArpSpa)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)1