public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] network tests: help script to run commands on remote host
@ 2014-02-26 10:00 Alexey Kodanev
  2014-03-19 18:21 ` chrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kodanev @ 2014-02-26 10:00 UTC (permalink / raw)
  To: ltp-list; +Cc: Vasily Isaenko

Hi!
There are some network tests which need to run various commands on the 
remote host. So is it a good idea to add a help script which does that 
according to chosen network protocol: rsh or ssh?

If yes, we can have a script like tst_rhost_run (or tst_run_rcmd...) in 
the ltp/tools, or somewhere else.

I did something similar in the submitted tcp_fastopen test, so the 
script could be as follows:

if [ "$use_ssh" -eq 1 ]; then
	ssh -n -f $user_name@$RHOST "sh -c 'nohup $rcmd &'" > /dev/null 2>&1
else
	rsh -n -l $user_name $RHOST "sh -c 'nohup $rcmd &'" > /dev/null 2>&1
fi

if [ $? -ne 0 ]; then
	tst_brkm TBROK NULL "No route to host $RHOST"
	exit 2
fi

Any suggestions, ideas?

Best regards,
Alexey


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&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] 3+ messages in thread

* Re: [LTP] network tests: help script to run commands on remote host
  2014-02-26 10:00 [LTP] network tests: help script to run commands on remote host Alexey Kodanev
@ 2014-03-19 18:21 ` chrubis
       [not found]   ` <533004A9.2080509@oracle.com>
  0 siblings, 1 reply; 3+ messages in thread
From: chrubis @ 2014-03-19 18:21 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: Vasily Isaenko, ltp-list

Hi!
> There are some network tests which need to run various commands on the 
> remote host. So is it a good idea to add a help script which does that 
> according to chosen network protocol: rsh or ssh?
> 
> If yes, we can have a script like tst_rhost_run (or tst_run_rcmd...) in 
> the ltp/tools, or somewhere else.
> 
> I did something similar in the submitted tcp_fastopen test, so the 
> script could be as follows:
> 
> if [ "$use_ssh" -eq 1 ]; then
> 	ssh -n -f $user_name@$RHOST "sh -c 'nohup $rcmd &'" > /dev/null 2>&1
> else
> 	rsh -n -l $user_name $RHOST "sh -c 'nohup $rcmd &'" > /dev/null 2>&1
> fi
> 
> if [ $? -ne 0 ]; then
> 	tst_brkm TBROK NULL "No route to host $RHOST"
> 	exit 2
> fi

Sounds good to me. The location for the file could be testcases/lib/.

One problem with the code above is that the error message can be
misleading, there is much more that could go wrong. One that comes to my
mind is when LTP is not installed on the remote machine.

And ideally we should use the new test.sh library. I would go for
exporting an TST_LIB_LOADED=1 variable in the test.sh and checking in
all sublibs that the variable exists to force the test to source the
test.sh first.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
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] network tests: help script to run commands on remote host
       [not found]   ` <533004A9.2080509@oracle.com>
@ 2014-03-24 14:13     ` chrubis
  0 siblings, 0 replies; 3+ messages in thread
From: chrubis @ 2014-03-24 14:13 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: Vasily Isaenko, ltp-list

Hi!
> >> There are some network tests which need to run various commands on the
> >> remote host. So is it a good idea to add a help script which does that
> >> according to chosen network protocol: rsh or ssh?
> >>
> >> If yes, we can have a script like tst_rhost_run (or tst_run_rcmd...) in
> >> the ltp/tools, or somewhere else.
> >>
> >> I did something similar in the submitted tcp_fastopen test, so the
> >> script could be as follows:
> >>
> >> if [ "$use_ssh" -eq 1 ]; then
> >> 	ssh -n -f $user_name@$RHOST "sh -c 'nohup $rcmd &'" > /dev/null 2>&1
> >> else
> >> 	rsh -n -l $user_name $RHOST "sh -c 'nohup $rcmd &'" > /dev/null 2>&1
> >> fi
> >>
> >> if [ $? -ne 0 ]; then
> >> 	tst_brkm TBROK NULL "No route to host $RHOST"
> >> 	exit 2
> >> fi
> > Sounds good to me. The location for the file could be testcases/lib/.
> >
> > One problem with the code above is that the error message can be
> > misleading, there is much more that could go wrong. One that comes to my
> > mind is when LTP is not installed on the remote machine.
> >
> > And ideally we should use the new test.sh library. I would go for
> > exporting an TST_LIB_LOADED=1 variable in the test.sh and checking in
> > all sublibs that the variable exists to force the test to source the
> > test.sh first.
> >
> OK, there is a question regarding different options for the command, 
> e.g. we can have:
> -b  run in background
> -s  safe option, if something goes wrong, will exit with TBROK
> -c  command
> Is this acceptable or I missed something?

Sounds reasonable to me.

We may find a need for more options later. I tend to add these at the
time it's actually needed rather than overegieneer libraries by adding
all bits that someone may possibly need.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
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-03-24 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-26 10:00 [LTP] network tests: help script to run commands on remote host Alexey Kodanev
2014-03-19 18:21 ` chrubis
     [not found]   ` <533004A9.2080509@oracle.com>
2014-03-24 14:13     ` chrubis

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