use of org.opendaylight.genius.mdsalutil.matches.MatchIpv6Destination in project netvirt by opendaylight.
the class AclServiceUtils method buildIpAndDstServiceMatch.
public static List<? extends MatchInfoBase> buildIpAndDstServiceMatch(Integer aclTag, AllowedAddressPairs aap) {
List<MatchInfoBase> flowMatches = new ArrayList<>();
flowMatches.add(buildRemoteAclTagMetadataMatch(aclTag));
if (aap.getIpAddress().getIpAddress() != null) {
if (aap.getIpAddress().getIpAddress().getIpv4Address() != null) {
MatchEthernetType ipv4EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV4);
flowMatches.add(ipv4EthMatch);
MatchIpv4Destination dstMatch = new MatchIpv4Destination(new Ipv4Prefix(aap.getIpAddress().getIpAddress().getIpv4Address().getValue() + "/32"));
flowMatches.add(dstMatch);
} else if (aap.getIpAddress().getIpAddress().getIpv6Address() != null) {
MatchEthernetType ipv6EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV6);
flowMatches.add(ipv6EthMatch);
MatchIpv6Destination dstMatch = new MatchIpv6Destination(new Ipv6Prefix(aap.getIpAddress().getIpAddress().getIpv6Address().getValue() + "/128"));
flowMatches.add(dstMatch);
}
} else if (aap.getIpAddress().getIpPrefix() != null) {
if (aap.getIpAddress().getIpPrefix().getIpv4Prefix() != null) {
MatchEthernetType ipv4EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV4);
flowMatches.add(ipv4EthMatch);
MatchIpv4Destination dstMatch = new MatchIpv4Destination(aap.getIpAddress().getIpPrefix().getIpv4Prefix());
flowMatches.add(dstMatch);
} else if (aap.getIpAddress().getIpPrefix().getIpv6Prefix() != null) {
MatchEthernetType ipv6EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV6);
flowMatches.add(ipv6EthMatch);
MatchIpv6Destination dstMatch = new MatchIpv6Destination(aap.getIpAddress().getIpPrefix().getIpv6Prefix());
flowMatches.add(dstMatch);
}
}
return flowMatches;
}
Aggregations