Some tests require IP addresses, either IPv4 or IPv6. Signed-off-by: Alexey Kodanev <alexey.koda...@oracle.com> --- v3: replace TST_EXEC_SUFFIX with TST_IPV6
testcases/lib/test_net.sh | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh index 24460f3..b6d4e7d 100644 --- a/testcases/lib/test_net.sh +++ b/testcases/lib/test_net.sh @@ -152,3 +152,25 @@ tst_read_opts() done OPTIND=0 } + +# Get IP address +# tst_ipaddr [TYPE] +# TYPE: { lhost | rhost }; Default value is 'lhost'. +tst_ipaddr() +{ + local type=${1:-"lhost"} + local ipv=${TST_IPV6:-"4"} + local tst_host= + + if [ "$type" = "lhost" ]; then + eval "tst_host=\$LHOST_IPV${ipv}_HOST" + else + eval "tst_host=\$RHOST_IPV${ipv}_HOST" + fi + + if [ "$TST_IPV6" ]; then + echo "${IPV6_NETWORK}:${tst_host}" + else + echo "${IPV4_NETWORK}.${tst_host}" + fi +} -- 1.7.1 ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list