@Override protected String ipv6AddressString(final Ipv6Address addr) { return addr.getValue(); }
/** * Constructs unique name for candidate path based on binding sid and weight * * @param bsid binding sid associated with candidate path * @param weight weight of actual sidList * @return candidate path name */ public static String getCandidatePathName(final Ipv6Address bsid, final long weight) { return bsid.getValue() + "-" + weight; }
public IpAddress(Ipv6Address _ipv6Address) { super(); this._ipv6Address = _ipv6Address; this._ipv4Address = null; this._value = _ipv6Address.getValue().toString().toCharArray(); }
private static Ipv6Prefix createPrefix(final Ipv6Address ipv6Address, final String mask) { if (mask != null && !mask.isEmpty()) { return new Ipv6Prefix(ipv6Address.getValue() + PREFIX_SEPARATOR + mask); } else { return new Ipv6Prefix(ipv6Address.getValue() + PREFIX_SEPARATOR + IPV6_ADDRESS_LENGTH); } }
public static Iterator<String> splitToParts(final Ipv6Address ipv6Address) { /* Invalid (Ab)use of ip address as prefix!!! */ return Iterators.forArray(ipv6Address.getValue(), String.valueOf(IPV6_ADDRESS_LENGTH)); }
private String doubleDotlessAddress(@Nonnull final Ipv6Address address) { // converted to use maximal compression // for details - https://google.github.io/guava/releases/snapshot/api/docs/com/google/common/net/InetAddresses.html#toAddrString-java.net.InetAddress return doubleDotless(compressedIpv6(address.getValue())); }
/** * Creates uncompressed IP Address * * @param ip to be uncompressed * @return Ipv6Address with same, but uncompressed, value */ public static Ipv6Address getFullForm(final Ipv6Address ip) { return new Ipv6Address(InetAddresses.forString(ip.getValue()).getHostAddress()); }
@Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Locator> instanceIdentifier, @Nonnull final Locator locator, @Nonnull final WriteContext writeContext) { Preconditions.checkNotNull(locator.getPrefix(), "Prefix should not be empty in locator: {}", locator); Ipv6Address locAddress = Preconditions.checkNotNull(locator.getPrefix().getAddress(), "Address in prefix should not be empty for locator: {}", locator); locatorCtx.removeLocator(locAddress.getValue(), writeContext.getMappingContext()); } }
@Override public void readSpecific(@Nonnull InstanceIdentifier<Policy> id, @Nonnull ReadContext ctx, @Nonnull PolicyBuilder builder) throws ReadFailedException { PolicyKey key = id.firstKeyOf(Policy.class); Ipv6Address bsid = policyCtx.getPolicyBsid(key.getColor(), key.getEndpoint().getIpv6Address(), ctx.getMappingContext()); dumpManager.getDump(id, ctx.getModificationCache()).or(STATIC_EMPTY_REPLY).srPoliciesDetails.stream() .filter(srPoliciesDetails -> arrayToIpv6AddressNoZone(srPoliciesDetails.bsid.addr).getValue() .equals(bsid.getValue())) .findFirst() .ifPresent((SrPoliciesDetails details) -> bindPolicy(details, ctx, builder)); }
private static String getStringIpAddress(final IpAddress ipAddress) { if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } return ipAddress.getIpv6Address().getValue(); }
private String touniqueIpAddress(IpAddress ipAddress) { Ipv4Address ipv4 = ipAddress.getIpv4Address(); if (ipv4 != null) { return ipv4.getValue(); } Ipv6Address ipv6 = ipAddress.getIpv6Address(); if (ipv6 != null) { return uniqueIpv6String(ipv6.getValue()); } return null; } private static String uniqueIpv6String(String ipv6) {
private static String getStringIpAddress(IpAddress ipAddress) { if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } return ipAddress.getIpv6Address().getValue(); }
public static String getStringIpAddress(IpAddress ipAddress) { if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } return ipAddress.getIpv6Address().getValue(); }
private String getAddressString(final IpAddress address) { Preconditions.checkArgument(address.getIpv4Address() != null || address.getIpv6Address() != null, "Address %s is invalid", address); if (address.getIpv4Address() != null) { return address.getIpv4Address().getValue(); } return address.getIpv6Address().getValue(); }
private String getAddressString(final IpAddress address) { Preconditions.checkArgument(address.getIpv4Address() != null || address.getIpv6Address() != null, "Address %s is invalid", address); if (address.getIpv4Address() != null) { return address.getIpv4Address().getValue(); } return address.getIpv6Address().getValue(); }
public static String touniqueIpAddress(TypedAddressData ipAddress) { if (ipAddress.getAddress() instanceof Ipv4AddressData) { return ((Ipv4AddressData) ipAddress.getAddress()).getIpv4().getValue().replaceAll("^ipv4:", ""); } if (ipAddress.getAddress() instanceof Ipv6AddressData) { return uniqueIpv6String( ((Ipv6AddressData) ipAddress.getAddress()).getIpv6(). getValue().replaceAll("^ipv6:", "")); } return null; } }
private InetSocketAddress getAddress() { final InetAddress inetAddr; try { inetAddr = InetAddress.getByName(getBindingAddress() .getIpv4Address() != null ? getBindingAddress() .getIpv4Address().getValue() : getBindingAddress() .getIpv6Address().getValue()); } catch (final UnknownHostException e) { throw new IllegalArgumentException("Illegal binding address " + getBindingAddress(), e); } return new InetSocketAddress(inetAddr, getBindingPort().getValue()); }
@Override public void serialize(MatchEntry entry, ByteBuf outBuffer) { super.serialize(entry, outBuffer); Ipv6NdTargetCase entryValue = (Ipv6NdTargetCase) entry.getMatchEntryValue(); writeIpv6Address(entryValue.getIpv6NdTarget().getIpv6Address().getValue(), outBuffer); }
@Override public void serialize(MatchEntry entry, ByteBuf outBuffer) { super.serialize(entry, outBuffer); Ipv6DstCase entryValue = (Ipv6DstCase) entry.getMatchEntryValue(); writeIpv6Address(entryValue.getIpv6Dst().getIpv6Address().getValue(), outBuffer); if (entry.isHasMask()) { writeMask(entryValue.getIpv6Dst().getMask(), outBuffer, EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES); } }
public static Action setIpv6DstAction(Ipv6Address ipAddress) { Ipv6Builder ipDest = new Ipv6Builder(); Ipv6Prefix prefixdst = new Ipv6Prefix(new Ipv6Prefix(ipAddress.getValue() + "/128")); ipDest.setIpv6Address(prefixdst); SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder(); setNwDstActionBuilder.setAddress(ipDest.build()); return new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build(); }