* [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests)
@ 2014-10-08 11:57 Alexey Kodanev
2014-10-08 11:57 ` [LTP] [PATCH v2 2/3] network/test_net: add tst_ipaddr Alexey Kodanev
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alexey Kodanev @ 2014-10-08 11:57 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
copy read_opts() from net_cmdlib.sh library
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/lib/test_net.sh | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 8cbcb70..2436264 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -137,3 +137,21 @@ tst_iface()
link_num=$(( $link_num + 1 ))
echo "$(tst_get_ifaces $type)" | awk '{ print $'"$link_num"' }'
}
+
+# Blank for an IPV4 test; 6 for an IPV6 test.
+TST_EXEC_SUFFIX=
+
+tst_read_opts()
+{
+ OPTIND=0
+ while getopts "6" opt; do
+ case "$opt" in
+ 6)
+ TST_EXEC_SUFFIX=6;;
+ *)
+ tst_brkm TBROK "tst_read_opts: unknown option: $opt"
+ ;;
+ esac
+ done
+ OPTIND=0
+}
--
1.7.1
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 2/3] network/test_net: add tst_ipaddr
2014-10-08 11:57 [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests) Alexey Kodanev
@ 2014-10-08 11:57 ` Alexey Kodanev
2014-10-08 11:57 ` [LTP] [PATCH 3/3] network/test_net: add tst_init_iface() and tst_set_ipaddr() Alexey Kodanev
2014-10-09 13:24 ` [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests) Hangbin Liu
2 siblings, 0 replies; 5+ messages in thread
From: Alexey Kodanev @ 2014-10-08 11:57 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Some tests require IP addresses, either IPv4 or IPv6.
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
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 2436264..8d0b6ad 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -155,3 +155,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_EXEC_SUFFIX:-"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_EXEC_SUFFIX" = "6" ]; then
+ echo "${IPV6_NETWORK}:${tst_host}"
+ else
+ echo "${IPV4_NETWORK}.${tst_host}"
+ fi
+}
--
1.7.1
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH 3/3] network/test_net: add tst_init_iface() and tst_set_ipaddr()
2014-10-08 11:57 [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests) Alexey Kodanev
2014-10-08 11:57 ` [LTP] [PATCH v2 2/3] network/test_net: add tst_ipaddr Alexey Kodanev
@ 2014-10-08 11:57 ` Alexey Kodanev
2014-10-09 13:24 ` [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests) Hangbin Liu
2 siblings, 0 replies; 5+ messages in thread
From: Alexey Kodanev @ 2014-10-08 11:57 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/lib/test_net.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 8d0b6ad..52abda4 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -177,3 +177,50 @@ tst_ipaddr()
echo "${IPV4_NETWORK}.${tst_host}"
fi
}
+
+# tst_init_iface [TYPE] [LINK]
+# TYPE: { lhost | rhost }; Default value is 'lhost'.
+# LINK: link number starting from 0. Default value is '0'.
+tst_init_iface()
+{
+ local type=${1:-"lhost"}
+ local link_num=${2:-"0"}
+
+ local iface=$(tst_iface $type $link_num)
+ tst_resm TINFO "initialize '$type' '$iface' interface"
+
+ if [ "$type" = "lhost" ]; then
+ ip link set $iface down || tst_brkm TBROK "interface down failed"
+ ip route flush dev $iface || tst_brkm TBROK "route flush failed"
+ ip addr flush dev $iface || tst_brkm TBROK "addr flush failed"
+ ip link set $iface up || tst_brkm TBROK "interface up failed"
+ else
+ tst_rhost_run -s -c "ip link set $iface down"
+ tst_rhost_run -s -c "ip route flush dev $iface"
+ tst_rhost_run -s -c "ip addr flush dev $iface"
+ tst_rhost_run -s -c "ip link set $iface up"
+ fi
+}
+
+# tst_set_ipaddr [LINK]
+# LINK: link number starting from 0. Default value is '0'.
+tst_set_ipaddr()
+{
+ local link_num=${1:-"0"}
+ local ipv=${TST_EXEC_SUFFIX:-"4"}
+
+ tst_init_iface lhost $link_num
+ tst_init_iface rhost $link_num
+
+ local iface=$(tst_iface $type $link_num)
+
+ local mask=24
+ [ "$TST_EXEC_SUFFIX" = "6" ] && mask=64
+
+ tst_resm TINFO "set local ipv${ipv} addr $(tst_ipaddr)/$mask"
+ ip addr add $(tst_ipaddr)/$mask dev $iface || \
+ tst_brkm TBROK "failed to add IP address"
+
+ tst_resm TINFO "set remote ipv${ipv} addr $(tst_ipaddr rhost)/$mask"
+ tst_rhost_run -s -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface"
+}
--
1.7.1
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests)
2014-10-08 11:57 [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests) Alexey Kodanev
2014-10-08 11:57 ` [LTP] [PATCH v2 2/3] network/test_net: add tst_ipaddr Alexey Kodanev
2014-10-08 11:57 ` [LTP] [PATCH 3/3] network/test_net: add tst_init_iface() and tst_set_ipaddr() Alexey Kodanev
@ 2014-10-09 13:24 ` Hangbin Liu
2014-10-15 10:10 ` Alexey Kodanev
2 siblings, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2014-10-09 13:24 UTC (permalink / raw)
To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list
Ah, find your patch here :)
Just as you said, net_cmdlib.sh source cmdlib.sh, so how about do it like
test.sh, add a global variable $CMD_LIB_LOADED in cmdlib.sh and add
[ -z "$CMD_LIB_LOADED" ] && . cmdlib.sh
in test_net.sh ?
For function read_opts(), I greped ltp and only found tests under tcp_cmds use
it. So I think it's OK to change all net_cmdlib.sh directly. But as your wish,
you can send it separately, not a big deal.
Thanks
Hangbin Liu
On Wed, Oct 08, 2014 at 03:57:43PM +0400, Alexey Kodanev wrote:
> copy read_opts() from net_cmdlib.sh library
>
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
> testcases/lib/test_net.sh | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
> index 8cbcb70..2436264 100644
> --- a/testcases/lib/test_net.sh
> +++ b/testcases/lib/test_net.sh
> @@ -137,3 +137,21 @@ tst_iface()
> link_num=$(( $link_num + 1 ))
> echo "$(tst_get_ifaces $type)" | awk '{ print $'"$link_num"' }'
> }
> +
> +# Blank for an IPV4 test; 6 for an IPV6 test.
> +TST_EXEC_SUFFIX=
> +
> +tst_read_opts()
> +{
> + OPTIND=0
> + while getopts "6" opt; do
> + case "$opt" in
> + 6)
> + TST_EXEC_SUFFIX=6;;
> + *)
> + tst_brkm TBROK "tst_read_opts: unknown option: $opt"
> + ;;
> + esac
> + done
> + OPTIND=0
> +}
> --
> 1.7.1
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
--
Thanks & Best Regards
Hangbin Liu <liuhangbin@gmail.com>
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests)
2014-10-09 13:24 ` [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests) Hangbin Liu
@ 2014-10-15 10:10 ` Alexey Kodanev
0 siblings, 0 replies; 5+ messages in thread
From: Alexey Kodanev @ 2014-10-15 10:10 UTC (permalink / raw)
To: Hangbin Liu; +Cc: vasily.isaenko, ltp-list
Hi,
On 10/09/2014 05:24 PM, Hangbin Liu wrote:
> Ah, find your patch here :)
>
> Just as you said, net_cmdlib.sh source cmdlib.sh, so how about do it like
> test.sh, add a global variable $CMD_LIB_LOADED in cmdlib.sh and add
>
> [ -z "$CMD_LIB_LOADED" ] && . cmdlib.sh
>
> in test_net.sh ?
No, we shouldn't use obsolete 'cmdlib.sh' and new 'test.sh' together.
> For function read_opts(), I greped ltp and only found tests under tcp_cmds use
> it. So I think it's OK to change all net_cmdlib.sh directly. But as your wish,
> you can send it separately, not a big deal.
It's preferably to additionally replace outdated interface with the new
one when tests need some fixes. Inevitably, the tests become fixed and
easy to support in the future, confirm with the latest suite standards
(e.g. test output, return exit codes).
That's why when I said that patches should be sent separately I also
meant the replacement of cmdlib.sh as well. Otherwise I don't see any
reason to replace just read_opts with identical one from another file.
Thanks,
Alexey
------------------------------------------------------------------------------
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-15 10:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 11:57 [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests) Alexey Kodanev
2014-10-08 11:57 ` [LTP] [PATCH v2 2/3] network/test_net: add tst_ipaddr Alexey Kodanev
2014-10-08 11:57 ` [LTP] [PATCH 3/3] network/test_net: add tst_init_iface() and tst_set_ipaddr() Alexey Kodanev
2014-10-09 13:24 ` [LTP] [PATCH 1/3] network/test_net: add support for -6 option (IPv6 tests) Hangbin Liu
2014-10-15 10:10 ` Alexey Kodanev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox