public final class NWUtil extends Object
Modifier and Type | Method and Description |
---|---|
static long |
convertInetAddressToLong(InetAddress address) |
static int |
getEtherTypeFromIpPrefix(String ipPrefix)
Utility API that returns the corresponding etherType based on the ipPrefix address family.
|
static List<BigInteger> |
getOperativeDPNs(org.opendaylight.controller.md.sal.binding.api.DataBroker dataBroker)
Returns the ids of the currently operative DPNs.
|
static int |
ipAddressToInt(String ipAddr) |
static boolean |
isIpAddressInRange(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress ipAddress,
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix cidr)
Checks if IP address is within CIDR range.
|
static boolean |
isIpAddressInRange(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address ipv6Address,
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix cidr)
Checks if IPv6 address is within CIDR range.
|
static boolean |
isIpInSubnet(int ipAddress,
String subnetCidr)
Checks if a given ipAddress belongs to a specific subnet.
|
static Boolean |
isIpv4Address(String ipAddress)
Utility API to check if the supplied ipAddress is IPv4 Address.
|
static String |
longToIpv4(long ipAddress,
long mask)
Converts IPv4 Address in long to String.
|
static long |
macByteToLong(byte[] macAddress)
Accepts a MAC address and returns the corresponding long, where the MAC
bytes are set on the lower order bytes of the long.
|
static long |
macToLong(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress macAddress)
Accepts a MAC address of the form 00:aa:11:bb:22:cc, case does not
matter, and returns the corresponding long, where the MAC bytes are set
on the lower order bytes of the long.
|
static byte[] |
parseMacAddress(String macAddress) |
static String |
toIpPrefix(String ipAddress)
Utility API that returns the corresponding ipPrefix based on the ipAddress.
|
static String |
toStringIpAddress(byte[] ipAddress) |
static String |
toStringMacAddress(byte[] macAddress) |
public static long convertInetAddressToLong(InetAddress address)
public static String longToIpv4(long ipAddress, long mask)
longToIpv4(long, long)
fixes the issue of MDSALUtil.longToIp(long, long)
not handling IP address greater than byte.ipAddress
- IP Address to be converted to Stringmask
- Network mask to be appendedpublic static int ipAddressToInt(String ipAddr) throws UnknownHostException
UnknownHostException
public static byte[] parseMacAddress(String macAddress)
public static String toStringIpAddress(byte[] ipAddress)
public static long macByteToLong(byte[] macAddress)
public static long macToLong(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress macAddress)
macAddress
- in String formatpublic static String toStringMacAddress(byte[] macAddress)
public static List<BigInteger> getOperativeDPNs(org.opendaylight.controller.md.sal.binding.api.DataBroker dataBroker)
public static Boolean isIpv4Address(String ipAddress)
ipAddress
- string-ified text of a possible IP addresspublic static boolean isIpInSubnet(int ipAddress, String subnetCidr)
ipAddress
- The Ip Address to checksubnetCidr
- Subnet represented as string with CIDRpublic static boolean isIpAddressInRange(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress ipAddress, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix cidr)
ipAddress
- the ip addresscidr
- the cidrpublic static boolean isIpAddressInRange(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address ipv6Address, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix cidr)
ipv6Address
- the IPv6 addresscidr
- the cidrpublic static String toIpPrefix(String ipAddress)
ipAddress
- string text of an IP addresspublic static int getEtherTypeFromIpPrefix(String ipPrefix)
ipPrefix
- the ipPrefix address string either IPv4 prefix or IPv6 prefix.Copyright © 2019 OpenDaylight. All rights reserved.