public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH RFC] testscripts/network: uniform network parameters
@ 2014-05-28 14:12 Alexey Kodanev
  2014-06-23 15:49 ` chrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kodanev @ 2014-05-28 14:12 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

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_INTERFACE and RHOST_INTERFACE variables.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testscripts/network.sh       |   53 ++++++++++++++++++++++++++++++++++++++++++
 testscripts/networkstress.sh |   36 ++++++----------------------
 testscripts/networktests.sh  |   10 +-------
 3 files changed, 62 insertions(+), 37 deletions(-)
 create mode 100755 testscripts/network.sh

diff --git a/testscripts/network.sh b/testscripts/network.sh
new file mode 100755
index 0000000..0b89c8e
--- /dev/null
+++ b/testscripts/network.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# Network Test Parameters
+#
+# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****---
+
+export RHOST=
+export PASSWD=
+
+# ---***************************************************---
+
+LTP_RSH=
+
+# Set names for test interfaces
+LHOST_INTERFACE=
+RHOST_INTERFACE=
+
+# Set first three octets of the network address
+IPV4_NETWORK=
+# Set local host last octet
+LHOST_IPV4_HOST=
+# Set remote host last octet
+RHOST_IPV4_HOST=
+# Set the reverse of IPV4_NETWORK
+IPV4_NETWORK_REVERSE=
+# Set firt three octets of the network address
+IPV6_NETWORK=
+# Set local host last octet
+LHOST_IPV6_HOST=
+# Set remote host last octet
+RHOST_IPV6_HOST=
+
+export HTTP_DOWNLOAD_DIR=
+export FTP_DOWNLOAD_DIR=
+export FTP_UPLOAD_DIR=
+export FTP_UPLOAD_URLDIR=
+
+# Set default parameters
+export LTP_RSH=${LTP_RSH:-"rsh -n"}
+export LHOST_INTERFACE=${LHOST_INTERFACE:-"eth0"}
+export RHOST_INTERFACE=${RHOST_INTERFACE:-"eth0"}
+export IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
+export IPV6_NETWORK=${IPV6_NETWORK:-"fd00:1:1:1"}
+export LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"}
+export RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"}
+export LHOST_IPV6_HOST=${LHOST_IPV6_HOST:-":2"}
+export RHOST_IPV6_HOST=${RHOST_IPV6_HOST:-":1"}
+export IPV4_NETWORK_REVERSE=${IPV4_NETWORK_REVERSE:-"0.0.10"}
+
+export TMPDIR=/tmp/netpan-$$
+mkdir -p $TMPDIR
+CMDFILE=${TMPDIR}/network.tests
+VERBOSE="no"
diff --git a/testscripts/networkstress.sh b/testscripts/networkstress.sh
index b40af72..7536d3f 100755
--- a/testscripts/networkstress.sh
+++ b/testscripts/networkstress.sh
@@ -12,32 +12,10 @@ if [ $? -eq 0 ]; then
  export LTPROOT=${PWD}
 fi
 
-export TMPDIR=/tmp/netst-$$
-mkdir $TMPDIR
-VERBOSE="no"
-INTERFACE="eth0"
-
-#===========================================================================
-# Network parameters
-export RHOST=
-export RHOST_HWADDRS=
-export HTTP_DOWNLOAD_DIR=
-export FTP_DOWNLOAD_DIR=
-export FTP_UPLOAD_DIR=
-export FTP_UPLOAD_URLDIR=
-
-# Set firt three octets of the network address, by default 10.0.0
-export IPV4_NETWORK=
-# Set local host last octet, by default 2
-export LHOST_IPV4_HOST=
-# Set remote host last octet, by default 1
-export RHOST_IPV4_HOST=
-# Set the reverse of IPV4_NETWORK, by default 0.0.10
-export IPV4_NETWORK_REVERSE=
+. $LTPROOT/testscripts/network.sh $0
 
 #===========================================================================
 # Default Test Settings
-# export LTP_RSH=rsh
 # export NS_DURATION=3600	# 1 hour
 # export NS_TIMES=10000
 # export CONNECTION_TOTAL=4000
@@ -102,8 +80,6 @@ if [ -z ${TEST_CASE} ]; then
 	usage
 fi
 
-export LHOST_HWADDRS=`ifconfig | grep ${INTERFACE} | grep HWaddr |awk '{print $5}'`
-
 if [ -z ${RHOST} ]; then
 	## Just a silly check
 	echo "Error: pay attention to configure"
@@ -111,6 +87,11 @@ if [ -z ${RHOST} ]; then
 	exit 1
 fi
 
+export LHOST_HWADDRS=$(/sbin/ifconfig | grep $LHOST_INTERFACE |\
+	grep HWaddr | awk '{print $5}')
+export RHOST_HWADDRS=$($LTP_RSH $RHOST /sbin/ifconfig |\
+	grep $RHOST_INTERFACE | grep HWaddr | awk '{print $5}')
+
 cat ${LTPROOT}/runtest/${TEST_CASE} > $TMPDIR/network_stress.tests
 
 cd $TMPDIR
@@ -119,9 +100,8 @@ export PATH="${PATH}:${LTPROOT}/testcases/bin"
 
 if [ ${VERBOSE} = "yes" ]; then
 	echo "Network parameters:"
-	echo " - ${INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})"
-	echo " - Remote IP address: ${RHOST}"
-	echo " - Remote MAC address: ${RHOST_HWADDRS}"
+	echo " - ${LHOST_INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})"
+	echo " - ${RHOST_INTERFACE} remote interface (MAC address: ${RHOST_HWADDRS})"
 
 	cat $TMPDIR/network_stress.tests
 	${LTPROOT}/ver_linux
diff --git a/testscripts/networktests.sh b/testscripts/networktests.sh
index b136749..507b7e3 100755
--- a/testscripts/networktests.sh
+++ b/testscripts/networktests.sh
@@ -1,11 +1,6 @@
 #!/bin/sh
 # This will run all the network tests, with the status logged in /tmp/netpan.log
 
-# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****---
-export RHOST=
-export PASSWD=
-# ---***************************************************---
-
 cd `dirname $0`
 export LTPROOT=${PWD}
 echo $LTPROOT | grep testscripts > /dev/null 2>&1
@@ -14,10 +9,7 @@ if [ $? -eq 0 ]; then
  export LTPROOT=${PWD}
 fi
 
-export TMPDIR=/tmp/netpan-$$
-mkdir -p $TMPDIR
-CMDFILE=${TMPDIR}/network.tests
-VERBOSE="no"
+. $LTPROOT/testscripts/network.sh $0
 
 # For bitwise operation to determine which testsets run
 CMD_IPV6=1		# 0x0001
-- 
1.7.1


------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH RFC] testscripts/network: uniform network parameters
  2014-05-28 14:12 [LTP] [PATCH RFC] testscripts/network: uniform network parameters Alexey Kodanev
@ 2014-06-23 15:49 ` chrubis
       [not found]   ` <53A950BC.2050203@oracle.com>
  0 siblings, 1 reply; 3+ messages in thread
From: chrubis @ 2014-06-23 15:49 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> diff --git a/testscripts/network.sh b/testscripts/network.sh
> new file mode 100755
> index 0000000..0b89c8e
> --- /dev/null
> +++ b/testscripts/network.sh
> @@ -0,0 +1,53 @@
> +#!/bin/sh
> +
> +# Network Test Parameters
> +#
> +# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****---
> +
> +export RHOST=
> +export PASSWD=
> +
> +# ---***************************************************---
> +
> +LTP_RSH=
> +
> +# Set names for test interfaces
> +LHOST_INTERFACE=
> +RHOST_INTERFACE=
> +
> +# Set first three octets of the network address
> +IPV4_NETWORK=
> +# Set local host last octet
> +LHOST_IPV4_HOST=
> +# Set remote host last octet
> +RHOST_IPV4_HOST=
> +# Set the reverse of IPV4_NETWORK
> +IPV4_NETWORK_REVERSE=
> +# Set firt three octets of the network address
> +IPV6_NETWORK=
> +# Set local host last octet
> +LHOST_IPV6_HOST=
> +# Set remote host last octet
> +RHOST_IPV6_HOST=
> +
> +export HTTP_DOWNLOAD_DIR=
> +export FTP_DOWNLOAD_DIR=
> +export FTP_UPLOAD_DIR=
> +export FTP_UPLOAD_URLDIR=
> +
> +# Set default parameters
> +export LTP_RSH=${LTP_RSH:-"rsh -n"}
> +export LHOST_INTERFACE=${LHOST_INTERFACE:-"eth0"}
> +export RHOST_INTERFACE=${RHOST_INTERFACE:-"eth0"}
> +export IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
> +export IPV6_NETWORK=${IPV6_NETWORK:-"fd00:1:1:1"}
> +export LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"}
> +export RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"}
> +export LHOST_IPV6_HOST=${LHOST_IPV6_HOST:-":2"}
> +export RHOST_IPV6_HOST=${RHOST_IPV6_HOST:-":1"}
> +export IPV4_NETWORK_REVERSE=${IPV4_NETWORK_REVERSE:-"0.0.10"}
> +
> +export TMPDIR=/tmp/netpan-$$
> +mkdir -p $TMPDIR
> +CMDFILE=${TMPDIR}/network.tests
> +VERBOSE="no"

A bit more documentation how to setup these would not harm. Do we have a
document that describes this?

> diff --git a/testscripts/networkstress.sh b/testscripts/networkstress.sh
> index b40af72..7536d3f 100755
> --- a/testscripts/networkstress.sh
> +++ b/testscripts/networkstress.sh
> @@ -12,32 +12,10 @@ if [ $? -eq 0 ]; then
>   export LTPROOT=${PWD}
>  fi
>  
> -export TMPDIR=/tmp/netst-$$
> -mkdir $TMPDIR
> -VERBOSE="no"
> -INTERFACE="eth0"
> -
> -#===========================================================================
> -# Network parameters
> -export RHOST=
> -export RHOST_HWADDRS=
> -export HTTP_DOWNLOAD_DIR=
> -export FTP_DOWNLOAD_DIR=
> -export FTP_UPLOAD_DIR=
> -export FTP_UPLOAD_URLDIR=
> -
> -# Set firt three octets of the network address, by default 10.0.0
> -export IPV4_NETWORK=
> -# Set local host last octet, by default 2
> -export LHOST_IPV4_HOST=
> -# Set remote host last octet, by default 1
> -export RHOST_IPV4_HOST=
> -# Set the reverse of IPV4_NETWORK, by default 0.0.10
> -export IPV4_NETWORK_REVERSE=
> +. $LTPROOT/testscripts/network.sh $0
>  
>  #===========================================================================
>  # Default Test Settings
> -# export LTP_RSH=rsh
>  # export NS_DURATION=3600	# 1 hour
>  # export NS_TIMES=10000
>  # export CONNECTION_TOTAL=4000
> @@ -102,8 +80,6 @@ if [ -z ${TEST_CASE} ]; then
>  	usage
>  fi
>  
> -export LHOST_HWADDRS=`ifconfig | grep ${INTERFACE} | grep HWaddr |awk '{print $5}'`
> -
>  if [ -z ${RHOST} ]; then
>  	## Just a silly check
>  	echo "Error: pay attention to configure"
> @@ -111,6 +87,11 @@ if [ -z ${RHOST} ]; then
>  	exit 1
>  fi
>  
> +export LHOST_HWADDRS=$(/sbin/ifconfig | grep $LHOST_INTERFACE |\
> +	grep HWaddr | awk '{print $5}')
> +export RHOST_HWADDRS=$($LTP_RSH $RHOST /sbin/ifconfig |\
> +	grep $RHOST_INTERFACE | grep HWaddr | awk '{print $5}')
> +

Calling ifconfig by full path is broken, Gentoo (and possible others)
has ifconfig in /bin/ (and you are allowed to call it as user to query
device configuration).

Moreover we may want to create a script to query interface IP and HWaddr
(and possibly others we may need) because ifconfig is deprecated and
some distros does not install it by default. If we move it to a library
we may write a code to use either ifconfig of ip depending on what is
available.

>  cat ${LTPROOT}/runtest/${TEST_CASE} > $TMPDIR/network_stress.tests
>  
>  cd $TMPDIR
> @@ -119,9 +100,8 @@ export PATH="${PATH}:${LTPROOT}/testcases/bin"
>  
>  if [ ${VERBOSE} = "yes" ]; then
>  	echo "Network parameters:"
> -	echo " - ${INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})"
> -	echo " - Remote IP address: ${RHOST}"
> -	echo " - Remote MAC address: ${RHOST_HWADDRS}"
> +	echo " - ${LHOST_INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})"
> +	echo " - ${RHOST_INTERFACE} remote interface (MAC address: ${RHOST_HWADDRS})"
>  
>  	cat $TMPDIR/network_stress.tests
>  	${LTPROOT}/ver_linux
> diff --git a/testscripts/networktests.sh b/testscripts/networktests.sh
> index b136749..507b7e3 100755
> --- a/testscripts/networktests.sh
> +++ b/testscripts/networktests.sh
> @@ -1,11 +1,6 @@
>  #!/bin/sh
>  # This will run all the network tests, with the status logged in /tmp/netpan.log
>  
> -# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****---
> -export RHOST=
> -export PASSWD=
> -# ---***************************************************---
> -
>  cd `dirname $0`
>  export LTPROOT=${PWD}
>  echo $LTPROOT | grep testscripts > /dev/null 2>&1
> @@ -14,10 +9,7 @@ if [ $? -eq 0 ]; then
>   export LTPROOT=${PWD}
>  fi
>  
> -export TMPDIR=/tmp/netpan-$$
> -mkdir -p $TMPDIR
> -CMDFILE=${TMPDIR}/network.tests
> -VERBOSE="no"
> +. $LTPROOT/testscripts/network.sh $0
>  
>  # For bitwise operation to determine which testsets run
>  CMD_IPV6=1		# 0x0001

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH RFC] testscripts/network: uniform network parameters
       [not found]   ` <53A950BC.2050203@oracle.com>
@ 2014-06-24 11:27     ` chrubis
  0 siblings, 0 replies; 3+ messages in thread
From: chrubis @ 2014-06-24 11:27 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> > A bit more documentation how to setup these would not harm. Do we have a
> > document that describes this?
> 
> Yes, there's a file which describes them, 'testcases/network/stress/README'.

Ok, looks good. What about we add this path in a comment to the script
with the settings?

> > Moreover we may want to create a script to query interface IP and HWaddr
> > (and possibly others we may need) because ifconfig is deprecated and
> > some distros does not install it by default. If we move it to a library
> > we may write a code to use either ifconfig of ip depending on what is
> > available.
> 
> Yes, e.g. many tests setting ipv4 and ipv6 addresses which can also be 
> moved to the library. Anyway, do you mean test-case library 
> 'test_net.sh'? If yes we will require setting TCID, ... variables in 
> configuration scripts, perhaps we can use "net_config" or other names 
> for ID. Will it be OK?

Yes, test_net.sh sounds like a good place for such functions.

Hmm, all the configuration and library scripts are in the end sourced to
some testcase which defines TCID and TST_TOTAL, or do I miss something?

> Most network tests use both 'ip' and 'ifconfig', so if we don't have one 
> of them, most tests will be broken. I would stay with 'ip' and try to 
> not using 'ifconfig'. What do you think?

Agreed.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-24 11:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-28 14:12 [LTP] [PATCH RFC] testscripts/network: uniform network parameters Alexey Kodanev
2014-06-23 15:49 ` chrubis
     [not found]   ` <53A950BC.2050203@oracle.com>
2014-06-24 11:27     ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox