@Override protected String ipv6PrefixString(final Ipv6Prefix prefix) { return prefix.getValue(); }
@Override protected String ipv6PrefixString(final Ipv6Prefix prefix) { return prefix.getValue(); }
public IpPrefix(Ipv6Prefix _ipv6Prefix) { super(); this._ipv6Prefix = _ipv6Prefix; this._ipv4Prefix = null; this._value = _ipv6Prefix.getValue().toString().toCharArray(); }
static Integer parseLength(@Nonnull final Ipv6Prefix prefix) { Matcher matcher = IP_PREFIX_PATTERN.matcher(prefix.getValue()); checkArgument(matcher.matches(), "Could`t parse Locator length: {}", prefix); return Integer.parseInt(matcher.group(GROUP_PREFIX)); }
private void initializeIpv6(Ipv6Prefix ipv6Prefix) throws UnknownHostException { if (ipv6Prefix != null) { subNet(ipv6Prefix); this.prefix = ipv6Prefix.getValue(); this.initialized = true; } }
static Ipv6Address parseLocator(@Nonnull final Ipv6Prefix prefix) { Matcher matcher = IP_PREFIX_PATTERN.matcher(prefix.getValue()); checkArgument(matcher.matches(), "Could`t parse Locator: {}", prefix); return new Ipv6Address(matcher.group(GROUP_IP)); } }
/** * Construct unique name from provided parentProtocolName and {@code Ipv6Prefix} */ public String uniqueRouteName(@Nonnull final String parentProtocolName, @Nonnull final Ipv6Prefix prefix) { return bindName(parentProtocolName, doubleDotlessAddress(prefix), prefix.getValue().substring(prefix.getValue().indexOf('/') + 1)); }
private static byte[] toByteMask(final Ipv6Prefix ipv6Prefix) { final int prefixLength = Short.valueOf(ipv6Prefix.getValue().split("/")[1]); return toByteMask(prefixLength); }
public char[] getValue() { if (_value == null) { if (_ipv4Prefix != null) { _value = _ipv4Prefix.getValue().toString().toCharArray(); } else if (_ipv6Prefix != null) { _value = _ipv6Prefix.getValue().toString().toCharArray(); } } return _value == null ? null : _value.clone(); }
private void subNet(Ipv6Prefix ipv6Prefix) throws UnknownHostException { String[] value = ipv6Prefix.getValue().split("[/]"); this.bits = Integer.parseInt(value[1]); ipv6Mask(); this.ipv6Subnet = ipv6ToInt(value[0]); }
/** * Creates address array from address part of {@link Ipv6Prefix} */ public static byte[] ipv6AddressPrefixToArray(@Nonnull final Ipv6Prefix ipv4Prefix) { checkNotNull(ipv4Prefix, "Cannot convert null prefix"); return ipv6AddressNoZoneToArray(new Ipv6AddressNoZone( new Ipv6Address(ipv4Prefix.getValue().substring(0, ipv4Prefix.getValue().indexOf('/'))))); }
/** * Construct unique name from provided {@code Route} */ public String uniqueRouteName(@Nonnull final String parentProtocolName, @Nonnull final Route route) { return bindName(parentProtocolName, // to have address in compressed form doubleDotlessAddress(route.getDestinationPrefix()), route.getDestinationPrefix().getValue().substring(route.getDestinationPrefix().getValue().indexOf('/') + 1)); }
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix v6LispPrefixToInetPrefix( final Ipv6Prefix prefix) { return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix( prefix.getIpv6Prefix().getValue()); }
public static String getStringIpPrefix(IpPrefix ipPrefix) { Preconditions.checkNotNull(ipPrefix); if (ipPrefix.getIpv4Prefix() != null) { String ipPrefixIpv4 = ipPrefix.getIpv4Prefix().getValue(); return ipPrefixIpv4.replace('/', '_'); } String ipPrefixIpv6 = ipPrefix.getIpv6Prefix().getValue(); return ipPrefixIpv6.replace('/', '_').replace(':', '.'); }
public static String ipPrefixToStringIpAddress(IpPrefix prefix) { if (prefix.getIpv4Prefix() != null) { String[] split = prefix.getIpv4Prefix().getValue().split("/"); return split[0]; } else if (prefix.getIpv6Prefix() != null) { String[] split = prefix.getIpv6Prefix().getValue().split("/"); return split[0]; } throw new IllegalArgumentException("Cannot extract IP prefix from IP address {}" + prefix); } }
private String getIpPrefixStr(final IpPrefix ipPrefix) { final Ipv4Prefix ipv4 = ipPrefix.getIpv4Prefix(); if (ipv4 != null) { return ipv4.getValue(); } else { return ipPrefix.getIpv6Prefix().getValue(); } }
private IpAddDelRoute getSpecialHopRequest(final boolean isAdd, @Nonnull final Ipv6Prefix destinationAddress, final byte primaryTableId, final byte secondaryTableId) { return flaglessAddDelRouteRequest(booleanToByte(isAdd), 0, null, DEFAULT_HOP_WEIGHT, BYTE_TRUE, ipv6AddressPrefixToArray(destinationAddress), extractPrefix(destinationAddress.getValue()), BYTE_FALSE, primaryTableId, secondaryTableId, DEFAULT_CLASSIFY_TABLE_INDEX, BYTE_FALSE); }
private IpAddDelRoute getMultipathHopRequest(final boolean isAdd, @Nonnull final Ipv6Prefix destinationAddress, final int nextHopInterfaceIndex, @Nonnull final Ipv6Address nextHopAddress, final byte nextHopWeight, final int primaryVrf, final int secondaryVrf, final int classifyTableIndex, final boolean classifyIndexSet) { return flaglessAddDelRouteRequest(booleanToByte(isAdd), nextHopInterfaceIndex, ipv6AddressNoZoneToArray(nextHopAddress), nextHopWeight, (byte)1, ipv6AddressPrefixToArray(destinationAddress), extractPrefix(destinationAddress.getValue()), (byte)1, primaryVrf, secondaryVrf, classifyTableIndex, booleanToByte(classifyIndexSet)); }
private IpAddDelRoute getSimpleHopRequest(final boolean isAdd, @Nonnull final Ipv6Prefix destinationAddress, final int nextHopInterfaceIndex, @Nonnull final Ipv6Address nextHopAddress, final int primaryVrf, final int secondaryVrf, final int classifyTableIndex, final boolean classifyIndexSet) { return flaglessAddDelRouteRequest(booleanToByte(isAdd), nextHopInterfaceIndex, ipv6AddressNoZoneToArray(nextHopAddress), DEFAULT_HOP_WEIGHT, BYTE_TRUE, ipv6AddressPrefixToArray(destinationAddress), extractPrefix(destinationAddress.getValue()), BYTE_FALSE, primaryVrf, secondaryVrf, classifyTableIndex, booleanToByte(classifyIndexSet)); }