public AllowedAddressPairs build() { return new AllowedAddressPairsImpl(this); }
public AllowedAddressPairsBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
public AllowedAddressPairsBuilder(AllowedAddressPairs base) { if (base.getKey() == null) { this._key = new AllowedAddressPairsKey( base.getIpAddress(), base.getMacAddress() ); this._ipAddress = base.getIpAddress(); this._macAddress = base.getMacAddress(); } else { this._key = base.getKey(); this._ipAddress = _key.getIpAddress(); this._macAddress = _key.getMacAddress(); } if (base instanceof AllowedAddressPairsImpl) { AllowedAddressPairsImpl impl = (AllowedAddressPairsImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
if (!Objects.equals(_ipAddress, other.getIpAddress())) { return false; if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_macAddress, other.getMacAddress())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private AllowedAddressPairsImpl(AllowedAddressPairsBuilder base) { if (base.getKey() == null) { this._key = new AllowedAddressPairsKey( base.getIpAddress(), base.getMacAddress() ); this._ipAddress = base.getIpAddress(); this._macAddress = base.getMacAddress(); } else { this._key = base.getKey(); this._ipAddress = _key.getIpAddress(); this._macAddress = _key.getMacAddress(); } switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
Integer priority, String flowId, int conntrackState, int conntrackMask, int addOrRemove) { for (AllowedAddressPairs allowedAddress : allowedAddresses) { IpPrefixOrAddress attachIp = allowedAddress.getIpAddress(); String attachMac = allowedAddress.getMacAddress().getValue();
/** * Gets the acl allowed address pairs. * * @param macAddress the mac address * @param ipAddress the ip address * @return the acl allowed address pairs */ protected static AllowedAddressPairs getAclAllowedAddressPairs(MacAddress macAddress, org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress ipAddress) { AllowedAddressPairsBuilder aclAllowedAdressPairBuilder = new AllowedAddressPairsBuilder(); aclAllowedAdressPairBuilder.setMacAddress(macAddress); if (ipAddress != null && ipAddress.getValue() != null) { if (ipAddress.getIpPrefix() != null) { aclAllowedAdressPairBuilder.setIpAddress(new IpPrefixOrAddress(ipAddress.getIpPrefix())); } else { aclAllowedAdressPairBuilder.setIpAddress(new IpPrefixOrAddress(ipAddress.getIpAddress())); } } return aclAllowedAdressPairBuilder.build(); }
public static List<AllowedAddressPairs> getUpdatedAllowedAddressPairs( List<AllowedAddressPairs> updatedAllowedAddressPairs, List<AllowedAddressPairs> currentAllowedAddressPairs) { if (updatedAllowedAddressPairs == null) { return null; } List<AllowedAddressPairs> newAllowedAddressPairs = new ArrayList<>(updatedAllowedAddressPairs); if (currentAllowedAddressPairs == null) { return newAllowedAddressPairs; } List<AllowedAddressPairs> origAllowedAddressPairs = new ArrayList<>(currentAllowedAddressPairs); for (Iterator<AllowedAddressPairs> iterator = newAllowedAddressPairs.iterator(); iterator.hasNext();) { AllowedAddressPairs updatedAllowedAddressPair = iterator.next(); for (AllowedAddressPairs currentAllowedAddressPair : origAllowedAddressPairs) { if (updatedAllowedAddressPair.getKey().equals(currentAllowedAddressPair.getKey())) { iterator.remove(); break; } } } return newAllowedAddressPairs; }
private static List<MatchInfoBase> updateAAPMatches(boolean isSourceIpMacMatch, List<MatchInfoBase> flows, AllowedAddressPairs aap) { List<MatchInfoBase> matchInfoBaseList; if (isSourceIpMacMatch) { matchInfoBaseList = AclServiceUtils.buildIpMatches(aap.getIpAddress(), MatchCriteria.MATCH_SOURCE); } else { matchInfoBaseList = AclServiceUtils.buildIpMatches(aap.getIpAddress(), MatchCriteria.MATCH_DESTINATION); } matchInfoBaseList.addAll(flows); return matchInfoBaseList; }
public static Map<String, List<MatchInfoBase>> getFlowForAllowedAddresses(List<AllowedAddressPairs> syncAllowedAddresses, Map<String, List<MatchInfoBase>> flowMatchesMap, boolean isSourceIpMacMatch) { if (flowMatchesMap == null) { return null; } Map<String, List<MatchInfoBase>> updatedFlowMatchesMap = new HashMap<>(); MatchInfoBase ipv4Match = new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV4}); MatchInfoBase ipv6Match = new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV6}); for (String flowName : flowMatchesMap.keySet()) { List<MatchInfoBase> flows = flowMatchesMap.get(flowName); // iterate over allow address pair and update match type for (AllowedAddressPairs aap : syncAllowedAddresses) { List<MatchInfoBase> matchInfoBaseList; String flowId; if (flows.contains(ipv4Match) && isIPv4Address(aap)) { matchInfoBaseList = updateAAPMatches(isSourceIpMacMatch, flows, aap); flowId = flowName + "_ipv4_remoteACL_interface_aap_" + aap.getKey(); updatedFlowMatchesMap.put(flowId, matchInfoBaseList); } else if (flows.contains(ipv6Match) && !isIPv4Address(aap)) { matchInfoBaseList = updateAAPMatches(isSourceIpMacMatch, flows, aap); flowId = flowName + "_ipv6_remoteACL_interface_aap_" + aap.getKey(); updatedFlowMatchesMap.put(flowId, matchInfoBaseList); } } } return updatedFlowMatchesMap; }
/** * Adds the rule to allow arp packets. * * @param dpId the dpId * @param allowedAddresses the allowed addresses * @param lportTag the lport tag * @param addOrRemove whether to add or remove the flow */ protected void programArpRule(BigInteger dpId, List<AllowedAddressPairs> allowedAddresses, int lportTag, int addOrRemove) { for (AllowedAddressPairs allowedAddress : allowedAddresses) { String attachMac = allowedAddress.getMacAddress().getValue(); List<MatchInfo> matches = new ArrayList<>(); matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_ARP})); matches.add(new MatchInfo(MatchFieldType.arp_sha, new String[] {attachMac})); matches.add(AclServiceUtils.buildLPortTagMatch(lportTag)); List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(new ArrayList<>()); String flowName = "Egress_ARP_" + dpId + "_" + attachMac; syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName, AclConstants.PROTO_ARP_TRAFFIC_MATCH_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove); } } }
Integer priority, String flowId, int conntrackState, int conntrackMask, String portId, int addOrRemove) { for (AllowedAddressPairs allowedAddress : allowedAddresses) { IpPrefixOrAddress attachIp = allowedAddress.getIpAddress(); String attachMac = allowedAddress.getMacAddress().getValue();
private static boolean isIPv4Address(AllowedAddressPairs aap) { IpPrefixOrAddress ipPrefixOrAddress = aap.getIpAddress(); IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix(); if (ipPrefix != null) { if (ipPrefix.getIpv4Prefix() != null) { return true; } } else { IpAddress ipAddress = ipPrefixOrAddress.getIpAddress(); if (ipAddress.getIpv4Address() != null) { return true; } } return false; }
if (flows.contains(ipv4Match) && isIPv4Address(aap)) { matchInfoBaseList = updateAAPMatches(isSourceIpMacMatch, flows, aap); flowId = flowName + "_ipv4_remoteACL_interface_aap_" + aap.getKey(); updatedFlowMatchesMap.put(flowId, matchInfoBaseList); } else if (flows.contains(ipv6Match) && !isIPv4Address(aap)) { matchInfoBaseList = updateAAPMatches(isSourceIpMacMatch, flows, aap); flowId = flowName + "_ipv6_remoteACL_interface_aap_" + aap.getKey(); updatedFlowMatchesMap.put(flowId, matchInfoBaseList);
Integer priority, String flowId, int conntrackState, int conntrackMask, String portId, int addOrRemove) { for (AllowedAddressPairs allowedAddress : allowedAddresses) { IpPrefixOrAddress attachIp = allowedAddress.getIpAddress(); String attachMac = allowedAddress.getMacAddress().getValue();