AclServiceUtils { public static List<AllowedAddressPairs> excludeMulticastAAPs(@Nullable List<AllowedAddressPairs> allowedAddresses) { List<AllowedAddressPairs> filteredAAPs = new ArrayList<>(); if (allowedAddresses != null) { for (AllowedAddressPairs allowedAddress : allowedAddresses) { InetAddress inetAddr = getInetAddress(allowedAddress.getIpAddress()); if (inetAddr != null && !inetAddr.isMulticastAddress()) { filteredAAPs.add(allowedAddress); } } } return filteredAAPs; } @Inject  AclServiceUtils(DataBroker dataBroker, AclDataUtil aclDataUtil, AclserviceConfig config,
            JobCoordinator jobCoordinator); static Optional<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces
        .Interface> getInterface(DataBroker broker, String interfaceName); static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
        .interfaces.Interface> getInterfaceIdentifier(String interfaceName); static Optional<T> read(
            DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> path); static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state
        .@Nullable Interface getInterfaceStateFromOperDS(DataBroker dataBroker, String interfaceName); static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
        .interfaces.state.Interface> buildStateInterfaceId(String interfaceName); @Nullable static SecurityRuleAttr getAccessListAttributes(Ace ace); static List<MatchInfoBase> buildDhcpMatches(int srcPort, int dstPort, int lportTag,
            Class<? extends ServiceModeBase> serviceMode); static List<MatchInfoBase> buildDhcpV6Matches(int srcPort, int dstPort, int lportTag,
            Class<? extends ServiceModeBase> serviceMode); static List<MatchInfoBase> buildIcmpV6Matches(int icmpType, int icmpCode, int lportTag,
            Class<? extends ServiceModeBase> serviceMode); static List<MatchInfoBase> buildBroadcastIpV4Matches(String ipAddr); static List<MatchInfoBase> buildL2BroadcastMatches(); static InstanceIdentifier<BoundServices> buildServiceId(String interfaceName, short serviceIndex,
            Class<? extends ServiceModeBase> serviceMode); static BoundServices getBoundServices(String serviceName, short servicePriority, int flowPriority,
            Uint64 cookie, List<Instruction> instructions); static List<Uuid> getUpdatedAclList(List<Uuid> updatedAclList, List<Uuid> currentAclList); static List<AllowedAddressPairs> getUpdatedAllowedAddressPairs(
            @Nullable List<AllowedAddressPairs> updatedAllowedAddressPairs,
            @Nullable List<AllowedAddressPairs> currentAllowedAddressPairs); @Nullable static BigInteger getDpIdFromIterfaceState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
            .interfaces.rev140508.interfaces.state.Interface interfaceState); static List<String> getIpBroadcastAddresses(List<SubnetInfo> subnetInfoList); static String getBroadcastAddressFromCidr(String cidr); static List<MatchInfoBase> buildIpMatches(IpPrefixOrAddress ipPrefixOrAddress,
                                                     MatchCriteria matchCriteria); static List<MatchInfoBase> buildArpIpMatches(IpPrefixOrAddress ipPrefixOrAddress); static MatchInfoBase buildRemoteAclTagMetadataMatch(Integer remoteAclTag); static Uint64 getRemoteAclTagMetadata(BigInteger remoteAclTag); static Uint64 getDropFlowCookie(int lport); static boolean doesIpv4AddressExists(List<AllowedAddressPairs> aaps); static boolean doesIpv6AddressExists(List<AllowedAddressPairs> aaps); static MatchInfoBase buildLPortTagMatch(int lportTag, Class<? extends ServiceModeBase> serviceMode); static List<MatchInfoBase> buildMatchesForLPortTagAndRemoteAclTag(Integer lportTag, Integer remoteAclTag,
            Class<? extends ServiceModeBase> serviceMode); static Collection<? extends MatchInfoBase> buildMatchesForLPortTagAndConntrackClassifierType(int lportTag,
            AclConntrackClassifierType conntrackClassifierType, Class<? extends ServiceModeBase> serviceMode); static InstructionWriteMetadata getWriteMetadataForAclClassifierType(
            AclConntrackClassifierType conntrackClassifierType); static InstructionWriteMetadata getWriteMetadataForDropFlag(); static InstructionWriteMetadata getWriteMetadataForRemoteAclTag(Integer remoteAclTag); static MatchInfoBase buildAclConntrackClassifierTypeMatch(
            AclConntrackClassifierType conntrackSupportedType); AclserviceConfig getConfig(); static boolean isIPv4Address(AllowedAddressPairs aap); static boolean isNotIpv4AllNetwork(AllowedAddressPairs aap); static boolean isNotIpAllNetwork(AllowedAddressPairs aap); @Nullable static Long getElanIdFromInterface(String elanInterfaceName, DataBroker broker); @Nullable static ElanInterface getElanInterfaceByElanInterfaceName(String elanInterfaceName,DataBroker broker); static InstanceIdentifier<ElanInterface> getElanInterfaceConfigurationDataPathId(String interfaceName); @Nullable static ElanInstance getElanInstanceByName(String elanInstanceName, DataBroker broker); static InstanceIdentifier<ElanInstance> getElanInstanceConfigurationDataPath(String elanInstanceName); void deleteAcesFromConfigDS(String aclName, List<Ace> deletedAceRules); static Integer getAclTag(Acl acl); Integer getAclTag(final Uuid aclId); static boolean isOfInterest(AclInterface aclInterface); static boolean isOfInterest(InterfaceAcl aclInterface); static List<? extends MatchInfoBase> buildIpAndSrcServiceMatch(Integer aclTag, AllowedAddressPairs aap); static List<? extends MatchInfoBase> buildIpAndDstServiceMatch(Integer aclTag, AllowedAddressPairs aap); static @NonNull List<Ace> aceList(@NonNull Acl acl); static @NonNull List<Ace> getAceListFromAcl(Acl acl); static List<MatchInfoBase> buildIpProtocolMatches(MatchEthernetType etherType, IPProtocols protocol); static boolean doesAceHaveRemoteGroupId(final SecurityRuleAttr aceAttr); SortedSet<Integer> getRemoteAclTags(@Nullable List<Uuid> aclIds, Class<? extends DirectionBase> direction); Set<Uuid> getRemoteAclIdsByDirection(@Nullable List<Uuid> aclIds, Class<? extends DirectionBase> direction); static Set<Uuid> getRemoteAclIdsByDirection(Acl acl, Class<? extends DirectionBase> direction); boolean skipDeleteInCaseOfOverlappingIP(String portId, Uuid remoteAclId, IpPrefixOrAddress ipPrefix,
            int addOrRemove); boolean doesRemoteAclIdExistsInAcls(List<Uuid> aclIds, Uuid remoteAclId,
            Class<? extends DirectionBase> direction); static InstanceIdentifier<AclPortsByIp> aclPortsByIpPath(String aclName); static InstanceIdentifier<AclIpPrefixes> getAclIpPrefixesPath(String aclName, IpPrefixOrAddress ipPrefix); static InstanceIdentifier<PortIds> getPortIdsPathInAclPortsLookup(String ruleName,
            IpPrefixOrAddress ipPrefix, String portId); void addAclPortsLookupForInterfaceUpdate(AclInterface portBefore, AclInterface portAfter); void deleteAclPortsLookupForInterfaceUpdate(AclInterface portBefore, AclInterface portAfter); void addAclPortsLookup(AclInterface port, List<Uuid> aclList,
            List<AllowedAddressPairs> allowedAddresses); void deleteAclPortsLookup(AclInterface port, List<Uuid> aclList,
            List<AllowedAddressPairs> allowedAddresses); Integer getAceFlowPriority(String aclName); static Integer getHardTimoutForApplyStatefulChangeOnExistingTraffic(Ace ace,
            AclServiceUtils aclServiceUtils); static List<InstructionInfo> createCtMarkInstructionForNewState(Short filterTable, Long elanId); static List<AllowedAddressPairs> excludeMulticastAAPs(@Nullable List<AllowedAddressPairs> allowedAddresses); static String getRecoverServiceRegistryKey(); static Boolean isIpv6Subnet(List<SubnetInfo> subnetInfoList); static List<SubnetInfo> getSubnetDiff(List<SubnetInfo> subnetInfo1, List<SubnetInfo> subnetInfo2);  }
@Test public void testExcludeMulticastAAPs() { List<AllowedAddressPairs> inputAAPs = new ArrayList<>(); buildInputAAP(inputAAPs, "1.1.1.1/32"); buildInputAAP(inputAAPs, "2.2.2.2"); buildInputAAP(inputAAPs, "2001:db8:85a3:0:0:8a2e:370:7334"); buildInputAAP(inputAAPs, "2002:db8:85a3::8a2e:370:7334/8"); List<AllowedAddressPairs> filteredAAPs = AclServiceUtils.excludeMulticastAAPs(inputAAPs); assertNotNull(filteredAAPs); assertEquals(inputAAPs, filteredAAPs); inputAAPs.clear(); buildInputAAP(inputAAPs, "224.0.0.0/24"); buildInputAAP(inputAAPs, "224.4.2.2"); buildInputAAP(inputAAPs, "FF01:0:0:0:0:0:0:1"); buildInputAAP(inputAAPs, "FF01::DB8:0:0/96"); filteredAAPs = AclServiceUtils.excludeMulticastAAPs(inputAAPs); assertNotNull(filteredAAPs); assertEquals(0, filteredAAPs.size()); inputAAPs.clear(); buildInputAAP(inputAAPs, "224.4.2.2"); buildInputAAP(inputAAPs, "3.3.3.3"); buildInputAAP(inputAAPs, "2001:db8:85a3:0:0:8a2e:370:7335"); buildInputAAP(inputAAPs, "FF01:0:0:0:0:0:0:2"); List<AllowedAddressPairs> tempAAPs = new ArrayList<>(); tempAAPs.add(buildAAp("3.3.3.3")); tempAAPs.add(buildAAp("2001:db8:85a3:0:0:8a2e:370:7335")); filteredAAPs = AclServiceUtils.excludeMulticastAAPs(inputAAPs); assertNotNull(filteredAAPs); assertEquals(2, filteredAAPs.size()); assertEquals(tempAAPs, filteredAAPs); inputAAPs.clear(); }