Package com.morpheusdata.core.util
Class NetworkUtility
java.lang.Object
com.morpheusdata.core.util.NetworkUtility
Utility methods for Network operations.
TODO: Javadoc needed for individual helper methods
- Since:
- 0.8.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
addressToCidr
(String address) static String
addressToSubnet
(String address) static Boolean
checkIpv4Ip
(String ipAddress) static String
cidrToAddress
(String address) static String
cleanHostname
(String name) static String
extractCidr
(String address, String cidr, String netmask) static String
extractSubnet
(String address, String cidr, String netmask) static String
getDomainRecordFqdn
(String name, String domain) static String
getDomainRecordName
(String name, String domain) static String
getFqdnDomainName
(String name) static String
getFriendlyDomainName
(String name) static Integer
getIpAddressCountBetween
(String startAddress, String endAddress) static String
getIpAddressIndex
(String name) static String
getIpAddressType
(String ipAddress) static BigInteger
getIpCountFromCidr
(String cidr) static String
static String
static Integer
getMaxPort
(String portRange) static Integer
getMinPort
(String portRange) static NetworkUtility.CidrInfo
getNetworkCidrConfig
(String cidr) getNetworksFromRange
(String ipStart, String ipEnd) static String
getNetworkSubnetMask
(NetworkPool networkPool, Network network, NetworkSubnet subnet) static String
getNextIpAddress
(String ipAddress) static String
getNextIpAddress
(String ipAddress, Integer increment) static String
getNextIpv6Address
(String ipAddress, Integer increment, String endAddress) static String
getReverseRecordName
(String name) static String
getServiceUrlHost
(String serviceUrl) static Integer
getServiceUrlPort
(String serviceUrl) static String
hexToSubnetMask
(String hexAddress) static Long
static long
static boolean
isIpv4InRange
(String rangeIpStart, String rangeIpEnd, String ipToCheck) Returns true if the ipv4 address ipToCheck is within the ipv4 range defined via the rangeIpStart and rangeIpEnd parametersstatic String
static String
networkToCidr
(String address, String netmask) static String
networkToDisplayCidr
(String address, String netmask) static String
networkToPrefixLength
(String address, String netmask) static String
normalizeIpAddress
(String ipAddress) static Boolean
validateAddressInRange
(String addr, String cidr) static Boolean
validateCidr
(String addr) static Boolean
validateCidr
(String addr, Boolean includeIPv6) static Boolean
validateIpAddr
(String addr) static Boolean
validateIpAddr
(String addr, Boolean includeIPv6) static Boolean
validateIpAddrOrCidr
(String addr) static Boolean
validateIpAddrOrCidr
(String addr, Boolean includeIPv6) static Boolean
static Boolean
validateIpAddrOrCidrOrRange
(String addr, Boolean includeIPv6) static Boolean
validateIpAddrOrRange
(String addr) static Boolean
validateIpAddrOrRange
(String addr, Boolean includeIPv6) static Boolean
validateIpRange
(String addr) static Boolean
validateIpRange
(String addr, Boolean includeIPv6) static Boolean
validateIpv4Cidr
(String addr) static Boolean
validateIpv6Cidr
(String addr)
-
Constructor Details
-
NetworkUtility
public NetworkUtility()
-
-
Method Details
-
validateIpAddr
-
validateIpAddr
-
validateIpAddrOrCidrOrRange
-
validateIpAddrOrCidrOrRange
-
validateIpAddrOrRange
-
validateIpAddrOrRange
-
validateIpRange
-
validateIpRange
-
validateIpAddrOrCidr
-
validateIpAddrOrCidr
-
validateCidr
-
validateCidr
-
validateIpv4Cidr
-
validateIpv6Cidr
-
validateAddressInRange
-
getNetworkCidrConfig
-
getIpAddressCountBetween
-
networkToCidr
-
networkToDisplayCidr
-
cidrToAddress
-
addressToCidr
-
addressToSubnet
-
extractCidr
-
extractSubnet
-
hexToSubnetMask
-
networkToPrefixLength
-
getNetworkSubnetMask
public static String getNetworkSubnetMask(NetworkPool networkPool, Network network, NetworkSubnet subnet) -
getServiceUrlHost
- Throws:
MalformedURLException
-
getServiceUrlPort
- Throws:
MalformedURLException
-
getDomainRecordFqdn
-
getDomainRecordName
-
getFriendlyDomainName
-
getFqdnDomainName
-
cleanHostname
-
getNextIpAddress
- Throws:
UnknownHostException
-
getNextIpAddress
public static String getNextIpAddress(String ipAddress, Integer increment) throws UnknownHostException - Throws:
UnknownHostException
-
getIpEndAddressFromCidr
- Throws:
inet.ipaddr.AddressStringException
-
getIpStartAddressFromCidr
public static String getIpStartAddressFromCidr(String cidr) throws inet.ipaddr.AddressStringException - Throws:
inet.ipaddr.AddressStringException
-
getIpCountFromCidr
- Throws:
inet.ipaddr.AddressStringException
-
getNextIpv6Address
-
getMinPort
-
getMaxPort
-
getNetworksFromRange
-
ipToLong
-
longToIp
-
iMask
-
checkIpv4Ip
-
getIpAddressType
- Throws:
UnknownHostException
-
normalizeIpAddress
- Throws:
UnknownHostException
-
getIpAddressIndex
-
getReverseRecordName
-
isIpv4InRange
Returns true if the ipv4 address ipToCheck is within the ipv4 range defined via the rangeIpStart and rangeIpEnd parameters- Parameters:
rangeIpStart
- ipv4 address for the start of the rangerangeIpEnd
- ipv4 address for the end of the rangeipToCheck
- ipv4 address to check- Returns:
- true if the address is within the range
-