public IpAddressNoZone(Ipv4AddressNoZone _ipv4AddressNoZone) { super(); this._ipv4AddressNoZone = _ipv4AddressNoZone; this._ipv6AddressNoZone = null; this._value = _ipv4AddressNoZone.getValue().toString().toCharArray(); }
/** * Transform Ipv4 address to a byte array acceptable by VPP. VPP expects incoming byte array to be in the same order * as the address. * * @return byte array with address bytes */ public static byte[] ipv4AddressNoZoneToArray(final Ipv4AddressNoZone ipv4Addr) { return ipv4AddressNoZoneToArray(ipv4Addr.getValue()); }
/** * Creates a new instance from Ipv4Address * * @param source Source object */ public Ipv4AddressNoZone(Ipv4Address source) { super(source); CodeHelpers.checkPattern(getValue(), patterns, regexes); }
/** * Return a String representing the value of this union. * * @return String representation of this union's value. */ public String stringValue() { if (_ipv4AddressNoZone != null) { return _ipv4AddressNoZone.getValue().toString(); } if (_ipv6AddressNoZone != null) { return _ipv6AddressNoZone.getValue().toString(); } throw new IllegalStateException("No value assinged"); }
public char[] getValue() { if (_value == null) { if (_ipv4AddressNoZone != null) { _value = _ipv4AddressNoZone.getValue().toString().toCharArray(); } else if (_ipv6AddressNoZone != null) { _value = _ipv6AddressNoZone.getValue().toString().toCharArray(); } } return _value == null ? null : _value.clone(); }
/** * Converts byte array to {@link Ipv4Prefix} with specified prefixLength */ public static Ipv4Prefix arrayToIpv4Prefix(final byte[] address, byte prefixLength) { Ipv4AddressNoZone addressPart = arrayToIpv4AddressNoZone(address); return new Ipv4Prefix(addressPart.getValue().concat("/").concat(String.valueOf(prefixLength))); }
static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix v4Prefix( final byte[] address, final byte prefix) { return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix( prefixValue(INSTANCE.arrayToIpv4AddressNoZone(address).getValue(), String.valueOf(prefix))); }
default String getArrayAsEidString(final EidType type, final byte[] address, final byte prefix) { switch (type) { case IPV4: { return prefix != DEFAULT_V4_PREFIX ? v4Prefix(address, prefix).getValue() : arrayToIpv4AddressNoZone(address).getValue(); } case IPV6: { return prefix != DEFAULT_V6_PREFIX ? v6Prefix(address, prefix).getValue() : arrayToIpv6AddressNoZone(address).getValue(); } case MAC: { //as wrong as it looks ,its right(second param is not end index,but count) return byteArrayToMacSeparated(Arrays.copyOfRange(address, 0, 6)); } case IPV4_PREFIX: { return v4Prefix(address, prefix).getValue(); } case IPV6_PREFIX: { return v6Prefix(address, prefix).getValue(); } default: { throw new IllegalStateException("Unknown type detected"); } } }