public abstract class IpNetwork extends Object implements Serializable
IpNetwork describes an IP network.
IP network is specified by an IP address and prefix length.| Modifier and Type | Field and Description |
|---|---|
static char |
CIDR_SEPARATOR
A character that separates prefix length from IP address in CIDR
notation.
|
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
contains(IpNetwork inw)
Determine whether this network contains the given IP host.
|
static IpNetwork |
create(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address addr)
Create an
IpNetwork instance which represents the IP network
specified by the given Address instance. |
static IpNetwork |
create(InetAddress iaddr)
Create an
IpNetwork instance which represents the given IP
address. |
static IpNetwork |
create(InetAddress iaddr,
int prefix)
Create an
IpNetwork instance which represents the IP network
specified by a pair of IP address and CIDR prefix. |
static IpNetwork |
create(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress ip)
Create an
IpNetwork instance which represents the IP address
specified by the given IpAddress instance. |
static IpNetwork |
create(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix ipp)
Create an
IpNetwork instance which represents the IP network
specified by the given IpPrefix instance. |
static IpNetwork |
create(String cidr)
Create an
IpNetwork instance which represents the IP network
specified by CIDR notation. |
abstract byte[] |
getBytes()
Return a byte array which represents the raw network address.
|
abstract String |
getCidrText()
Return a string representation of this network in CIDR notation.
|
String |
getCidrValue()
Deprecated.
Only for JAXB. Use
getCidrText() instead. |
abstract String |
getHostAddress()
Return a string representation of this network address without
CIDR prefix.
|
InetAddress |
getInetAddress()
Return an
InetAddress instance which represents the IP network
address. |
static InetAddress |
getInetAddress(byte[] bytes)
Create an
InetAddress instance which represents the IP address
specified by the given byte array. |
static InetAddress |
getInetAddress(String text)
Create an
InetAddress instance which represents the IP address
specified by the given string. |
abstract org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress |
getIpAddress()
Return an
IpAddress instance which represents this instance. |
abstract org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix |
getIpPrefix()
Return an
IpPrefix instance which represents this instance. |
abstract int |
getMaxPrefix()
Return the maximum length of the network prefix.
|
abstract org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address |
getMdAddress()
Return a MD-SAL IP address which represents this network address.
|
int |
getPrefixLength()
Return the length of network prefix.
|
String |
getText()
Return a string representation of IP network.
|
boolean |
isAddress()
Determine whether this instance represents an IP address or not.
|
String |
toString()
Return a string representation of this object.
|
public static final char CIDR_SEPARATOR
public static final InetAddress getInetAddress(byte[] bytes)
InetAddress instance which represents the IP address
specified by the given byte array.bytes - A byte array which represents the IP address.InetAddress instance.IllegalArgumentException - The given byte array does not represent an IP network mask.public static final InetAddress getInetAddress(String text)
InetAddress instance which represents the IP address
specified by the given string.text - A string representation of an IP address.InetAddress instance.NullPointerException - text is null.IllegalArgumentException - The given string does not represent an IP address.public static final IpNetwork create(InetAddress iaddr)
IpNetwork instance which represents the given IP
address.iaddr - An InetAddress instance.IpNetwork instance which represents the given IP
address. Note that null is returned if iaddr
is null.IllegalArgumentException - The given IP address is invalid.public static final IpNetwork create(InetAddress iaddr, int prefix)
IpNetwork instance which represents the IP network
specified by a pair of IP address and CIDR prefix.iaddr - An InetAddress instance.prefix - Prefix length that specifies network range.
Note that zero means "no mask". So zero is treated as if
the maximum prefix length is specified.IpNetwork instance which represents the IP network
specified by the given IP address and CIDR prefix.
Note that null is returned if iaddr is
null.IllegalArgumentException - The given IP address or prefix is invalid.public static final IpNetwork create(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix ipp)
IpNetwork instance which represents the IP network
specified by the given IpPrefix instance.ipp - An IpPrefix instance which represents the IP
network.IpNetwork instance which represents the IP network
specified by ipp. Note that null is returned
if ipp is null or it does not contain valid
value.IllegalArgumentException - The given IpPrefix instance is invalid.public static final IpNetwork create(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress ip)
IpNetwork instance which represents the IP address
specified by the given IpAddress instance.ip - An IpAddress instance which represents the IP
address.IpNetwork instance which represents the given
IP address. Note that null is returned if ip
is null or it does not contain valid value.IllegalArgumentException - The given IpAddress instance is invalid.public static final IpNetwork create(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address addr)
IpNetwork instance which represents the IP network
specified by the given Address instance.addr - An Address instance which represents the
IP address.IpNetwork instance which represents the IP network
specified by addr. Note that null is returned
if addr is null or it does not contain valid
value.IllegalArgumentException - The given Address instance is invalid.public static final IpNetwork create(String cidr)
IpNetwork instance which represents the IP network
specified by CIDR notation.cidr - A string representation of the IP network in CIDR notation.
Note that zero prefix means "no mask". So zero prefix is
treated as if the maximum prefix length is specified.IpNetwork instance which represents the IP network
specified by cidr. Note that null is returned
if cidr is null.IllegalArgumentException - The given network address is invalid.public final int getPrefixLength()
public final InetAddress getInetAddress()
InetAddress instance which represents the IP network
address.InetAddress instance.public final String getText()
If this instance represents a specific IP host, an IP address of the host without prefix length is returned. Otherwise a string which represents the IP network in CIDR notation is returned.
public final boolean isAddress()
true if this instance represents an IP address.
false if this instance represents an IP network
specified by a pair of network address and prefix length.public abstract int getMaxPrefix()
public abstract org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix getIpPrefix()
IpPrefix instance which represents this instance.IpPrefix instance.public abstract org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress getIpAddress()
IpAddress instance which represents this instance.
This method returns an IP address which represents a string representation of this network address without CIDR prefix.
IpAddress instance.public abstract org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address getMdAddress()
Address instance.public abstract String getCidrText()
public abstract String getHostAddress()
public abstract byte[] getBytes()
public abstract boolean contains(IpNetwork inw)
inw - An IpNetwork instance to be tested.
Note that this method assumes that this argument specifies
the IP host, not IP network. So the CIDR prefix length
configured in this argument is always ignored.true only if the IP network corresponding to this
instance contains the IP network specified by inw.NullPointerException - inw is null.IllegalArgumentException - This instance cannot test the given network.public final String getCidrValue()
getCidrText() instead.Copyright © 2018 OpenDaylight. All rights reserved.