network: uniform network parameters

* Move networktests.sh and networkstress.sh parameters to network.sh.
  Both network scripts have the same settings (e.g. RHOST), and
  some of the stress test parameters can be used by other net-tests,
  such as LHOST_IFACES and RHOST_IFACES variables.
* Add network features group to networkstress.sh.
* Add network features group to 'whole' group.

New test_net.sh functions:
* 'tst_get_ifaces TYPE' get test interface names for local/remote host
  (Note that it returns already defined iface list);
* 'tst_get_hwaddrs TYPE' get addresses from defined test interface names;
* 'tst_hwaddr TYPE LINK' get test HW address;
* 'tst_iface  TYPE LINK' get test interface name;

TYPE can be 'rhost' or 'lhost' (default).
LINK is the test link number starting from 0 (default).

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 51b3e38..8cbcb70 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -75,3 +75,65 @@
 
 	return $ret
 }
+
+# Get test interface names for local/remote host.
+# tst_get_ifaces [TYPE]
+# TYPE: { lhost | rhost }; Default value is 'lhost'.
+tst_get_ifaces()
+{
+	local type=${1:-"lhost"}
+	if [ "$type" = "lhost" ]; then
+		echo "$LHOST_IFACES"
+	else
+		echo "$RHOST_IFACES"
+	fi
+}
+
+# Get HW addresses from defined test interface names.
+# tst_get_hwaddrs [TYPE]
+# TYPE: { lhost | rhost }; Default value is 'lhost'.
+tst_get_hwaddrs()
+{
+	local type=${1:-"lhost"}
+	local addr=
+	local list=
+
+	for eth in $(tst_get_ifaces $type); do
+
+		local addr_path="/sys/class/net/${eth}/address"
+
+		case $type in
+		lhost) addr=$(cat $addr_path) ;;
+		rhost) addr=$(tst_rhost_run -s -c "cat $addr_path")
+		esac
+
+		[ -z "$list" ] && list="$addr" || list="$list $addr"
+	done
+	echo "$list"
+}
+
+# Get test HW address.
+# tst_hwaddr [TYPE] [LINK]
+# TYPE: { lhost | rhost }; Default value is 'lhost'.
+# LINK: link number starting from 0. Default value is '0'.
+tst_hwaddr()
+{
+	local type=${1:-"lhost"}
+	local link_num=${2:-"0"}
+	local hwaddrs=
+	link_num=$(( $link_num + 1 ))
+	[ "$type" = "lhost" ] && hwaddrs=$LHOST_HWADDRS || hwaddrs=$RHOST_HWADDRS
+	echo "$hwaddrs" | awk '{ print $'"$link_num"' }'
+}
+
+# Get test interface name.
+# tst_iface [TYPE] [LINK]
+# TYPE: { lhost | rhost }; Default value is 'lhost'.
+# LINK: link number starting from 0. Default value is '0'.
+tst_iface()
+{
+	local type=${1:-"lhost"}
+	local link_num=${2:-"0"}
+	link_num=$(( $link_num + 1 ))
+	echo "$(tst_get_ifaces $type)" | awk '{ print $'"$link_num"' }'
+}