private static Ipv4Prefix createPrefix(final String address) { return new Ipv4Prefix(address + PREFIX); } }
@Override protected String ipv4PrefixString(final Ipv4Prefix prefix) { return prefix.getValue(); }
@ConstructorProperties("value") public Ipv4Prefix(java.lang.String _value) { if (_value != null) { check_valueLength(_value); } Preconditions.checkNotNull(_value, "Supplied value may not be null"); for (Pattern p : patterns) { Preconditions.checkArgument(p.matcher(_value).matches(), "Supplied value \"%s\" does not match required pattern \"%s\"", _value, p); } this._value = _value; }
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix v4LispPrefixToInetPrefix( final Ipv4Prefix prefix) { return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix( prefix.getIpv4Prefix().getValue()); }
public static IpPrefix createGwPrefix(IpAddress ipAddress, IpPrefix network) { StringBuilder buf = new StringBuilder(); buf.append(ipAddress.getValue()); String str = network.getIpv4Prefix().getValue(); buf.append(str.substring(str.indexOf("/"))); return new IpPrefix(new Ipv4Prefix(buf.toString())); }
public static Ipv4Prefix getDefaultInstance(String defaultValue) { return new Ipv4Prefix(defaultValue); }
@Override protected String ipv4PrefixString(final Ipv4Prefix prefix) { return prefix.getValue(); }
default Address normalizeIfPrefixBased(Address address){ if(address instanceof Ipv4Prefix){ final String[] parts = ((Ipv4Prefix) address).getIpv4Prefix().getValue().split("/"); return new Ipv4PrefixBuilder().setIpv4Prefix( new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix( prefixValue(parts[0], parts[1]))) .build(); } if (address instanceof Ipv6Prefix){ final String[] parts = ((Ipv6Prefix) address).getIpv6Prefix().getValue().split("/"); return new Ipv6PrefixBuilder().setIpv6Prefix( new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix( prefixValue(parts[0], parts[1]))).build(); } // if not prefix based, does nothing return address; }
@ConstructorProperties("value") public Ipv4Prefix(String _value) { if (_value != null) { check_valueLength(_value); } Objects.requireNonNull(_value, "Supplied value may not be null"); CodeHelpers.checkPattern(_value, patterns, regexes); this._value = _value; }
public static Ipv4Prefix getDefaultInstance(String defaultValue) { return new Ipv4Prefix(defaultValue); }
private static String getAdddressFromPrefix(final Ipv4Prefix prefix) { return prefix.getValue().split(SLASH)[0]; }
public static Ipv4Prefix getDefaultInstance(String defaultValue) { return new Ipv4Prefix(defaultValue); }
public Ipv4Prefix ipv4PrefixFromUniqueRouteName(@Nonnull final String uniqueName) { String[] parts = uniqueName.split(UNDERSCORE); return new Ipv4Prefix(dotted(parts[1]) + "/" + parts[2]); }
public IpPrefix(Ipv4Prefix _ipv4Prefix) { super(); this._ipv4Prefix = _ipv4Prefix; this._ipv6Prefix = null; this._value = _ipv4Prefix.getValue().toString().toCharArray(); }
public static void addMatchSrcIpv4(MatchBuilder match, String srcIpStr, int netmask) { addMatchSrcIpv4(match, new Ipv4Prefix(srcIpStr + "/" + String.valueOf(netmask))); }
/** * Creates address array from address part of {@link Ipv4Prefix} */ public static byte[] ipv4AddressPrefixToArray(@Nonnull final Ipv4Prefix ipv4Prefix) { checkNotNull(ipv4Prefix, "Cannot convert null prefix"); byte[] retval = new byte[4]; String[] address = ipv4Prefix.getValue().substring(0, ipv4Prefix.getValue().indexOf('/')).split("\\."); for (int d = 0; d < 4; d++) { retval[d] = (byte) (Short.parseShort(address[d]) & 0xff); } return retval; }
static Ipv4Prefix createPrefix(final Ipv4Address ipv4Address, final String mask){ /* * Ipv4Address 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 (null != mask && !mask.isEmpty()) { return new Ipv4Prefix(ipv4Address.getValue() + PREFIX_SEPARATOR + mask); } else { return new Ipv4Prefix(ipv4Address.getValue() + PREFIX_SEPARATOR + IPV4_ADDRESS_LENGTH); } } }
public static Iterator<String> splitToParts(final Ipv4Prefix ipv4Prefix) { return PREFIX_SPLITTER.split(ipv4Prefix.getValue()).iterator(); }
public static void addMatchDstIpv4(MatchBuilder match, String dstIpStr, int netmask) { addMatchDstIpv4(match, new Ipv4Prefix(dstIpStr + "/" + String.valueOf(netmask))); }