Package org.opendaylight.protocol.util
Class InetSocketAddressUtil
java.lang.Object
org.opendaylight.protocol.util.InetSocketAddressUtil
Created as a util for test tools.
-
Method Summary
Modifier and TypeMethodDescriptionstatic InetSocketAddress
getInetSocketAddress
(String hostPortString, Integer defaultPort) static InetSocketAddress
static InetSocketAddress
getRandomLoopbackInetSocketAddress
(int port) static String
Generate a random loopback ip address.static int
Generate a random high range port number.static List<InetSocketAddress>
parseAddresses
(String address) static List<InetSocketAddress>
parseAddresses
(String address, int defaultPort) static com.google.common.net.HostAndPort
toHostAndPort
(InetSocketAddress address)
-
Method Details
-
parseAddresses
-
parseAddresses
-
toHostAndPort
-
getInetSocketAddress
-
getRandomLoopbackInetSocketAddress
-
getRandomLoopbackInetSocketAddress
-
getRandomPort
public static int getRandomPort()Generate a random high range port number.- Returns:
- A port number range from 20000 to 60000
-
getRandomLoopbackIpAddress
Generate a random loopback ip address. IP address range: 127.50.50.50 ~ 127.250.250.250 We did not utilize the whole 127./8 range to avoid using common addresses like 127.0.0.1- Returns:
- Generated random loopback IP address
-