PING Functions

sth::emulation_ping

Purpose

Sends ICMP ECHO_REQUESTs from the specified test port and returns the PING results

Synopsis

Note

M indicates that the argument is Mandatory .

sth::emulation_ping
     [-host {a.b.c.d|<aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh>}  M]
     [-handle <handle>]
     [-port_handle <portHandle>]
     [-count <integer>]
     [-interval <integer>]
     [-mac_address_start <aa:bb:cc:dd:ee:ff>]

Arguments

-port_handle

Specifies the handle of the port from which to send ICMP ECHO_REQUESTs. -port_handle and -handle are mutually exclusive. It is Mandatory to specify either of the two but not both.

-handle

Specifies the host handle from which to send ICMP ECHO_REQUESTs. For example, the handle received from function sth::interface_config. -port_handle and -handle are mutually exclusive. It is Mandatory to specify either of the two but not both.

-count

Specifies the number of ICMP ECHO_REQUEST messages to send as a fixed number of datagrams.

-host

Specifies the IPV4/IPv6 address or hostname of the host to ping. The value must be in IPv4 or IPv6 format. This argument is Mandatory .

-interval

Specifies the interval in seconds between successive transmissions of ICMP ECHO_REQUEST packets.

-mac_address_start

Initial MAC address of the interfaces created for the PING configuration. This argument is only supported when -port_handle is specified.

Arguments Unsupported by Save as HLTAPI

None

Cisco-specific Arguments

The following arguments are specific to the Cisco HLTAPI but are not supported by Spirent HLTAPI:

-size
-pad
-ttl
-vci
-vpi

Return Values

Depending on the specific language that HLTAPI uses, the function returns a keyed list/dictionary/hash (See Introduction for more information on return value formats) using the following keys (with corresponding data):

tx <integer>
                The cumulative number of transmitted packets

rx <integer>
                The cumulative number of received packets

max <integer>
                The maximum round-trip time in milliseconds

min <integer>
                The minimum round-trip time in milliseconds

avg <integer>
                The average round-trip time in milliseconds

pct_loss <float>
                The cumulative percentage of lost packets

count <integer>
                The number of received echo responses

log
                Returns debugging information when the status is $FAILURE

status
                Success (1) or failure (0) of the operation

Description

The sth::emulation_ping function verifies the connection between the test port and the specified host computer. It sends an ECHO request to the host, and then waits for a response. You can specify how many requests to send and at what intervals. The returned keyed list displays whether the ping was successful (that is, whether the host is available) as well as information about the packets transmitted and received and the time it took to send and receive them. Use PING to troubleshoot Internet connections.

Examples

The following example sends ICMP ECHO_REQUESTs from a specified port handle:

sth::emulation_ping -port_handle port1 -host 1.1.1.1

Sample output:

{status 1} {tx 10} {rx 10} {pct_loss 0%} {count 10} {min 0.473} {avg 0.598}
{max 1.528}

The following example uses an previously created host handle as the input:

sth::emulation_ping -handle host1 -host 21.1.1.2 -count 4

Sample Output:

{status 1} {1 {{bytes 64} {replyfrom 21.1.1.2} {icmp_seq 1} {ttl 63}
{time 3.866}}} {2 {{bytes 64} {replyfrom 21.1.1.2} {icmp_seq 2} {ttl 63}
{time 2.464}}} {3 {{bytes 64} {replyfrom 21.1.1.2} {icmp_seq 3} {ttl 63}
{time 2.450}}} {4 {{bytes 64} {replyfrom 21.1.1.2} {icmp_seq 4} {ttl 63}
{time 2.513}}} {tx 4} {rx 4} {pct_loss 0.0%} {count 4} {min 2.450} {avg
 2.823} {max 3.866}

The following example uses an previously created IPv6 host handle as the input:

sth::emulation_ping   -handle   $handles   -count   5   -host  2001::2

Sample Output:

{1 {{bytes 64} {replyfrom 2001} {icmp_seq 1} {ttl 64} {time 0.555}}} {2
{{bytes 64} {replyfrom 2001} {icmp_seq 2} {ttl 64} {time 0.251}}} {3 {{bytes
64} {replyfrom 2001} {icmp_seq 3} {ttl 64} {time 0.234}}} {4 {{bytes 64}
{replyfrom 2001} {icmp_seq 4} {ttl 64} {time 0.226}}} {5 {{bytes 64} {replyfr
om 2001} {icmp_seq 5} {ttl 64} {time 0.232}}} {tx 5} {rx 5} {pct_loss 0.0%}
{count 5} {min 0.226} {avg 0.300} {max 0.555} {status 1}

End of Procedure Header