public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity
Date: Wed, 09 Mar 2016 15:11:36 +0300	[thread overview]
Message-ID: <56E012F8.7020504@oracle.com> (raw)
In-Reply-To: <56E01222.6020909@oracle.com>

re-sending to the new ltp list...

On 03/09/2016 03:08 PM, Alexey Kodanev wrote:
> Hi,
> On 03/07/2016 10:01 AM, Hangbin Liu wrote:
>> Signed-off-by: Hangbin Liu <haliu@redhat.com>
>> ---
>>   testcases/lib/test_net.sh | 37 +++++++++++++++++++++++++++++++++++++
>>   1 file changed, 37 insertions(+)
>>
>> diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
>> index 418fed3..f75e78e 100644
>> --- a/testcases/lib/test_net.sh
>> +++ b/testcases/lib/test_net.sh
>> @@ -314,3 +314,40 @@ tst_netload()
>>         return $ret
>>   }
>> +
>> +# tst_ping IFACE ADDR [SIZE]
>> +# Check icmp connectivity
>> +# IFACE: source interface name
>> +# ADDR: destination IPv4 or IPv6 address
>> +# SIZE: message size
>> +tst_ping()
>> +{
>> +    # The max number of ICMP echo request
>> +    PING_MAX=${PING_MAX:-"10"}
>> +
>> +    # Check the arguments
>> +    if [ $# -lt 2 ]; then
>> +        tst_resm TBROK "tst_ping src_iface dest_ipv4/6_addr [msg_size]"
>> +        return 1
>> +    fi
>> +
>> +    local src_iface=$1
>> +    local dst_addr=$2
>
> They could be defaulted to $(tst_iface) and $(tst_ipaddr rhost) 
> accordingly.
> Then, we don't have to check the number of arguments and it fits for 
> the most cases.
>
>> +    # ping cmd use 56 as default message size
>> +    local msg_size=${3:-"56"}
>> +
>> +    if echo $dst_addr | grep ":"; then
>> +        local PING="ping6"
>> +        TST_IPV6=6
>> +    else
>> +        local PING="ping"
>> +    fi
>> +
>
> if test runs with -6 option, TST_IPV6 will be defined as 6, otherwise 
> is "".
> We can use it inside test_net.sh and tests. So here, we could call 
> ping command
> as follows: "ping$TST_IPV6 ..."
>
>
>> +    if [ "$dst_addr" == "$(tst_ipaddr)" ]; then
>> +        tst_rhost_run -c "$PING -I $src_iface -c $PING_MAX $dst_addr \
>> +            -s $msg_size > /dev/null 2>&1"
>> +    else
>> +        $PING -I $src_iface -c $PING_MAX $dst_addr -s $msg_size > \
>> +            /dev/null 2>&1
>> +    fi
>> +}
>
> Do we actually need to run this command from remote host?
>
> Best regards,
> Alexey
>


  reply	other threads:[~2016-03-09 12:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1457334114-10461-1-git-send-email-haliu@redhat.com>
     [not found] ` <1457334114-10461-2-git-send-email-haliu@redhat.com>
2016-03-09 12:08   ` [LTP] [PATCH 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity Alexey Kodanev
2016-03-09 12:11     ` Alexey Kodanev [this message]
2016-03-10  6:22       ` Hangbin Liu
2016-03-10  7:23         ` Alexey Kodanev
2016-03-11  3:00           ` Hangbin Liu
2016-03-07  7:20 [LTP] [PATCH 0/3] networking/stress: add ip xfrm ipsec support Hangbin Liu
2016-03-07  7:20 ` [LTP] [PATCH 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity Hangbin Liu
  -- strict thread matches above, loose matches on Subject: below --
2016-03-07  7:14 [LTP] [PATCH 0/3] networking/stress: add ip xfrm ipsec support Hangbin Liu
2016-03-07  7:14 ` [LTP] [PATCH 1/3] lib/test_net.sh: add tst_ping() to check icmp connectivity Hangbin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56E012F8.7020504@oracle.com \
    --to=alexey.kodanev@oracle.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox