def ping(<EOL>self,<EOL>destination,<EOL>source=C.PING_SOURCE,<EOL>ttl=C.PING_TTL,<EOL>timeout=C.PING_TIMEOUT,<EOL>size=C.PING_SIZE,<EOL>count=C.PING_COUNT,<EOL>vrf=C.PING_VRF,<EOL>):
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.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>if "<STR_LIT>" in line:<EOL><INDENT>sent_and_received = re.search(r"<STR_LIT>", line)<EOL>probes_sent = int(sent_and_received.group(<NUM_LIT:2>))<EOL>probes_received = int(sent_and_received.group(<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>if "<STR_LIT>" in line:<EOL><INDENT>break<EOL><DEDENT>min_avg_max = re.search(r"<STR_LIT>", line)<EOL>ping_dict["<STR_LIT:success>"].update(<EOL>{<EOL>"<STR_LIT>": float(min_avg_max.group(<NUM_LIT:1>)),<EOL>"<STR_LIT>": float(min_avg_max.group(<NUM_LIT:2>)),<EOL>"<STR_LIT>": float(min_avg_max.group(<NUM_LIT:3>)),<EOL>}<EOL>)<EOL>results_array = []<EOL>for i in range(probes_received):<EOL><INDENT>results_array.append(<EOL>{<EOL>"<STR_LIT>": py23_compat.text_type(destination),<EOL>"<STR_LIT>": <NUM_LIT:0.0>,<EOL>}<EOL>)<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)