+ * Creates remote the acl id pools.
+ */
+ public void createRemoteAclIdPool() {
+ createIdPoolForAclTag(AclConstants.ACL_TAG_POOL_NAME);
+ }
+
+ /**
+ * Delete remote the acl id pools.
+ */
+ public void deleteRemoteAclIdPool() {
+ deleteIdPool(AclConstants.ACL_TAG_POOL_NAME);
+ }
+
+ public static List<? extends MatchInfoBase> buildIpAndSrcServiceMatch(Integer aclTag, AllowedAddressPairs ip,
+ DataBroker dataBroker) {
+ List<MatchInfoBase> flowMatches = new ArrayList<>();
+ flowMatches.add(buildAclTagMetadataMatch(aclTag));
+ if (ip.getIpAddress().getIpAddress() != null) {
+ if (ip.getIpAddress().getIpAddress().getIpv4Address() != null) {
+ MatchEthernetType ipv4EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV4);
+ flowMatches.add(ipv4EthMatch);
+ MatchIpv4Source srcMatch = new MatchIpv4Source(
+ new Ipv4Prefix(ip.getIpAddress().getIpAddress().getIpv4Address().getValue() + "/32"));
+ flowMatches.add(srcMatch);
+ } else if (ip.getIpAddress().getIpAddress().getIpv6Address() != null) {
+ MatchEthernetType ipv6EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV6);
+ flowMatches.add(ipv6EthMatch);
+ MatchIpv6Source srcMatch = new MatchIpv6Source(
+ new Ipv6Prefix(ip.getIpAddress().getIpAddress().getIpv6Address().getValue() + "/128"));
+ flowMatches.add(srcMatch);
+ }
+ } else if (ip.getIpAddress().getIpPrefix() != null) {
+ if (ip.getIpAddress().getIpPrefix().getIpv4Prefix() != null) {
+ MatchEthernetType ipv4EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV4);
+ flowMatches.add(ipv4EthMatch);
+ MatchIpv4Source srcMatch = new MatchIpv4Source(ip.getIpAddress().getIpPrefix().getIpv4Prefix());
+ flowMatches.add(srcMatch);
+ } else if (ip.getIpAddress().getIpPrefix().getIpv6Prefix() != null) {
+ MatchEthernetType ipv6EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV6);
+ flowMatches.add(ipv6EthMatch);
+ MatchIpv6Source srcMatch = new MatchIpv6Source(ip.getIpAddress().getIpPrefix().getIpv6Prefix());
+ flowMatches.add(srcMatch);
+ }
+ }
+ return flowMatches;
+ }
+
+ public static List<? extends MatchInfoBase> buildIpAndDstServiceMatch(Integer aclTag, AllowedAddressPairs ip,
+ DataBroker dataBroker) {
+ List<MatchInfoBase> flowMatches = new ArrayList<>();
+ flowMatches.add(buildAclTagMetadataMatch(aclTag));
+
+ if (ip.getIpAddress().getIpAddress() != null) {
+ if (ip.getIpAddress().getIpAddress().getIpv4Address() != null) {
+ MatchEthernetType ipv4EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV4);
+ flowMatches.add(ipv4EthMatch);
+ MatchIpv4Destination dstMatch = new MatchIpv4Destination(
+ new Ipv4Prefix(ip.getIpAddress().getIpAddress().getIpv4Address().getValue() + "/32"));
+ flowMatches.add(dstMatch);
+ } else if (ip.getIpAddress().getIpAddress().getIpv6Address() != null) {
+ MatchEthernetType ipv6EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV6);
+ flowMatches.add(ipv6EthMatch);
+ MatchIpv6Destination dstMatch = new MatchIpv6Destination(
+ new Ipv6Prefix(ip.getIpAddress().getIpAddress().getIpv6Address().getValue() + "/128"));
+ flowMatches.add(dstMatch);
+ }
+ } else if (ip.getIpAddress().getIpPrefix() != null) {
+ if (ip.getIpAddress().getIpPrefix().getIpv4Prefix() != null) {
+ MatchEthernetType ipv4EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV4);
+ flowMatches.add(ipv4EthMatch);
+ MatchIpv4Destination dstMatch =
+ new MatchIpv4Destination(ip.getIpAddress().getIpPrefix().getIpv4Prefix());
+ flowMatches.add(dstMatch);
+ } else if (ip.getIpAddress().getIpPrefix().getIpv6Prefix() != null) {
+ MatchEthernetType ipv6EthMatch = new MatchEthernetType(NwConstants.ETHTYPE_IPV6);
+ flowMatches.add(ipv6EthMatch);
+ MatchIpv6Destination dstMatch =
+ new MatchIpv6Destination(ip.getIpAddress().getIpPrefix().getIpv6Prefix());
+ flowMatches.add(dstMatch);
+ }
+ }
+ return flowMatches;
+ }
+
+ public static boolean isOfAclInterest(Acl acl) {
+ List<Ace> aceList = acl.getAccessListEntries().getAce();
+ if (aceList != null && !aceList.isEmpty()) {
+ return aceList.get(0).getAugmentation(SecurityRuleAttr.class) != null;
+ }
+ return false;
+ }
+
+ public static void addLportTagMetadataMatch(int lportTag, List<MatchInfoBase> flowMatches,
+ Class<? extends ServiceModeBase> serviceMode) {
+ MatchInfoBase lportMatch = buildLPortTagMatch(lportTag, serviceMode);
+ InterfaceServiceUtil.mergeMetadataMatchsOrAdd(flowMatches, lportMatch);
+ }
+
+ /**
+ * Returns ACL specific key for synchronization.