def ping(self, destination, source=C.PING_SOURCE, ttl=C.PING_TTL, timeout=C.PING_TIMEOUT,<EOL>size=C.PING_SIZE, count=C.PING_COUNT, vrf=C.PING_VRF):
ping_dict = {}<EOL>if vrf:<EOL><INDENT>command = '<STR_LIT>'.format(vrf, destination)<EOL><DEDENT>else:<EOL><INDENT>command = '<STR_LIT>'.format(destination)<EOL><DEDENT>command += '<STR_LIT>'.format(timeout)<EOL>command += '<STR_LIT>'.format(size)<EOL>command += '<STR_LIT>'.format(count)<EOL>if source != '<STR_LIT>':<EOL><INDENT>command += '<STR_LIT>'.format(source)<EOL><DEDENT>output = self._send_command(command)<EOL>if '<STR_LIT:%>' in output:<EOL><INDENT>ping_dict['<STR_LIT:error>'] = output<EOL><DEDENT>elif '<STR_LIT>' in output:<EOL><INDENT>ping_dict['<STR_LIT:success>'] = {<EOL>'<STR_LIT>': <NUM_LIT:0>,<EOL>'<STR_LIT>': <NUM_LIT:0>,<EOL>'<STR_LIT>': <NUM_LIT:0>,<EOL>'<STR_LIT>': <NUM_LIT:0.0>,<EOL>'<STR_LIT>': <NUM_LIT:0.0>,<EOL>'<STR_LIT>': <NUM_LIT:0.0>,<EOL>'<STR_LIT>': <NUM_LIT:0.0>,<EOL>'<STR_LIT>': []<EOL>}<EOL>for line in output.splitlines():<EOL><INDENT>fields = line.split()<EOL>if '<STR_LIT>' in line:<EOL><INDENT>sent_and_received = re.search(r'<STR_LIT>', fields[<NUM_LIT:5>])<EOL>probes_sent = int(sent_and_received.groups()[<NUM_LIT:0>])<EOL>probes_received = int(sent_and_received.groups()[<NUM_LIT:1>])<EOL>ping_dict['<STR_LIT:success>']['<STR_LIT>'] = probes_sent<EOL>ping_dict['<STR_LIT:success>']['<STR_LIT>'] = probes_sent - probes_received<EOL><DEDENT>elif '<STR_LIT>' in line:<EOL><INDENT>sent_and_received = re.search(r'<STR_LIT>', fields[<NUM_LIT:5>])<EOL>probes_sent = int(sent_and_received.groups()[<NUM_LIT:0>])<EOL>probes_received = int(sent_and_received.groups()[<NUM_LIT:1>])<EOL>min_avg_max = re.search(r'<STR_LIT>', fields[<NUM_LIT:9>])<EOL>ping_dict['<STR_LIT:success>']['<STR_LIT>'] = probes_sent<EOL>ping_dict['<STR_LIT:success>']['<STR_LIT>'] = probes_sent - probes_received<EOL>ping_dict['<STR_LIT:success>'].update({<EOL>'<STR_LIT>': float(min_avg_max.groups()[<NUM_LIT:0>]),<EOL>'<STR_LIT>': float(min_avg_max.groups()[<NUM_LIT:1>]),<EOL>'<STR_LIT>': float(min_avg_max.groups()[<NUM_LIT:2>]),<EOL>})<EOL>results_array = []<EOL>for i in range(probes_received):<EOL><INDENT>results_array.append({'<STR_LIT>': py23_compat.text_type(destination),<EOL>'<STR_LIT>': <NUM_LIT:0.0>})<EOL><DEDENT>ping_dict['<STR_LIT:success>'].update({'<STR_LIT>': results_array})<EOL><DEDENT><DEDENT><DEDENT>return ping_dict<EOL>
Execute ping on the device and returns a dictionary with the result.

Output dictionary has one of following keys:
    * success
    * error
In case of success, inner dictionary will have the followin keys:
    * probes_sent (int)
    * packet_loss (int)
    * rtt_min (float)
    * rtt_max (float)
    * rtt_avg (float)
    * rtt_stddev (float)
    * results (list)
'results' is a list of dictionaries with the following keys:
    * ip_address (str)
    * rtt (float)