public static Ipv6Prefix getDefaultInstance(String defaultValue) { return new Ipv6Prefix(defaultValue); }
public static Ipv6Prefix getDefaultInstance(String defaultValue) { return new Ipv6Prefix(defaultValue); }
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 Ipv6Prefix ipv6PrefixFromUniqueRouteName(@Nonnull final String uniqueName) { String[] parts = uniqueName.split(UNDERSCORE); return new Ipv6Prefix(coloned(parts[1]) + "/" + parts[2]); }
public static void addMatchDstIpv6(MatchBuilder match, String dstIpStr, int netmask) { addMatchDstIpv6(match, new Ipv6Prefix(dstIpStr + "/" + String.valueOf(netmask))); }
private static Ipv6Prefix createPrefix(final Ipv6Address ipv6Address) { return new Ipv6Prefix(ipv6Address.getValue() + PREFIX_SEPARATOR + IPV6_ADDRESS_LENGTH); }
public static void addMatchSrcIpv6(MatchBuilder match, String srcIpStr, int netmask) { addMatchSrcIpv6(match, new Ipv6Prefix(srcIpStr + "/" + String.valueOf(netmask))); }
/** * Converts byte array to {@link Ipv6Prefix} with specified prefixLength */ public static Ipv6Prefix arrayToIpv6Prefix(final byte[] address, byte prefixLength) { Ipv6AddressNoZone addressPart = arrayToIpv6AddressNoZone(address); return new Ipv6Prefix(addressPart.getValue().concat("/").concat(String.valueOf(prefixLength))); }
public static Ipv6Prefix createPrefix(final Ipv6Address ipv6Address, final String mask){ /* * Ipv6Address has already validated the address part of the prefix, * It is mandated to comply to the same regexp as the address * There is absolutely no point rerunning additional checks vs this * Note - there is no canonical form check here!!! */ if (Strings.isNullOrEmpty(mask)) { return new Ipv6Prefix(ipv6Address.getValue() + PREFIX_SEPARATOR + String.valueOf(IPV6_ADDRESS_LENGTH)); } else { return new Ipv6Prefix(ipv6Address.getValue() + PREFIX_SEPARATOR + mask); } }
public static IpPrefix getDefaultInstance(final String defaultValue) { return IPV4_PATTERN.matcher(defaultValue).matches() ? new IpPrefix(new Ipv4Prefix(defaultValue)) : new IpPrefix(new Ipv6Prefix(defaultValue)); } }
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()); }
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix v6Prefix( final byte[] address, final byte prefix) { return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix( prefixValue(INSTANCE.arrayToIpv6AddressNoZone(address).getValue(), String.valueOf(prefix))); }
@Override public Ipv6Prefix getLocator(@Nonnull final String name, @Nonnull final MappingContext ctx) { final Optional<Srv6LocatorMapping> read = ctx.read(getLocatorIid(name)); if (read.isPresent()) { return read.get().getPrefix(); } // construct artificial mapping with default locator length Ipv6Prefix ipv6Prefix = new Ipv6Prefix(getArtificialName(name)); addLocator(getArtificialName(name), ipv6Prefix, ctx); return ipv6Prefix; }
@Override public void readCurrentAttributes(@Nonnull final InstanceIdentifier<State> instanceIdentifier, @Nonnull final StateBuilder stateBuilder, @Nonnull final ReadContext readContext) throws ReadFailedException { L3SteeringRequest request = new L3SteeringRequest(getFutureJVpp()); List<IpPrefix> ipPrefixes = request.readAllIpPrefixes(RWUtils.cutId(instanceIdentifier, Prefixes.class), readContext); // checks whether L3 steering contains default routes to steer all traffic to SRv6 policy. If found sets // allPrefixes flag to true in autoroute-include/prefixes/state boolean allPrefixes = ipPrefixes.containsAll( ImmutableSet.of(new IpPrefix(new Ipv4Prefix("0.0.0.0/0")), new IpPrefix(new Ipv6Prefix("::/0")))); stateBuilder.setPrefixesAll(allPrefixes); }
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(); }
public static IpPrefix ipAddressToIpPrefix(IpAddress address) { if (address.getIpv4Address() != null) { return new IpPrefix(new Ipv4Prefix(ipv4PrefixOf(address))); } else if (address.getIpv6Address() != null) { return new IpPrefix(new Ipv6Prefix(ipv6PrefixOf(address))); } throw new IllegalArgumentException("Ip address [{}] is not a valid Ipv4 or Ipv6 address." + address); }
public static IpPrefix serializeModel(final ContainerNode prefixDesc) { if (prefixDesc.getChild(IP_REACH_NID).isPresent()) { final String prefix = (String) prefixDesc.getChild(IP_REACH_NID).get().getValue(); try { Ipv4Util.bytesForPrefixBegin(new Ipv4Prefix(prefix)); return new IpPrefix(new Ipv4Prefix(prefix)); } catch (final IllegalArgumentException e) { LOG.debug("Creating Ipv6 prefix because", e); return new IpPrefix(new Ipv6Prefix(prefix)); } } return null; } }
public static Action setIpv6SrcAction(Ipv6Address ipAddress) { Ipv6Builder ipSrc = new Ipv6Builder(); Ipv6Prefix prefixdst = new Ipv6Prefix(new Ipv6Prefix(ipAddress.getValue() + "/128")); ipSrc.setIpv6Address(prefixdst); SetNwSrcActionBuilder setNwSrcActionBuilder = new SetNwSrcActionBuilder(); setNwSrcActionBuilder.setAddress(ipSrc.build()); return new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwSrcActionBuilder.build()).build(); }
@Override public void writeCurrentAttributes(@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); Preconditions.checkNotNull(locator.getPrefix().getLength(), "Length in prefix should not be empty for locator: {}", locator); Ipv6Address locAddress = Preconditions.checkNotNull(locator.getPrefix().getAddress(), "Address in prefix should not be empty for locator: {}", locator); Short locLength = Preconditions.checkNotNull(locator.getPrefix().getLength().getValue(), "Length in prefix should not be empty for locator: {}", locator); locatorCtx.addLocator(locAddress.getValue(), new Ipv6Prefix(locAddress.getValue() + "/" + locLength), writeContext.getMappingContext()); }
private List<Ipv6Prefixes> extractPrefixes(final Collection<MapEntryNode> routes) { final List<Ipv6Prefixes> prefs = new ArrayList<>(routes.size()); for (final MapEntryNode route : routes) { final String prefix = (String) NormalizedNodes.findNode(route, routePrefixIdentifier()).get().getValue(); prefs.add(new Ipv6PrefixesBuilder().setPathId(PathIdUtil.buildPathId(route, routePathIdNid())).setPrefix(new Ipv6Prefix(prefix)).build()); } return prefs; } }