Skip to content

Commit

Permalink
squash! riotctrl_shell: provide ping6 interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jun 24, 2020
1 parent 9673175 commit b341d39
Showing 1 changed file with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,25 @@ def ping6(self, hostname, count=3, interval=1000, packet_size=4,
packet_size=packet_size, timeout=timeout)

if hop_limit is not None:
cmd += " -h {hop_limit}".format(hop_limit)
cmd += " -h {hop_limit}".format(hop_limit=hop_limit)

term = self.node.term
term.sendline(cmd)
self._cmd(cmd)
res = GNRCICMPv6Echo.Results()

for c in range(count + 1):
res = term.expect([r"\d+ bytes from (?P<source>[0-9a-f:]+): "
r"icmp_seq=(?P<seq>\d+) ttl=(?P<ttl>\d+) "
r"(rssi=(?P<rssi>-?\d+) dBm )?"
r"time=(?P<rtt>\d+.\d+) ms",
r"(?P<tx>\d+) packets transmitted, "
r"(?P<rx>\d+) packets received, "
r"(?P<packet_loss>\d+)% packet loss"])
res = self._expect([r"\d+ bytes from (?P<source>[0-9a-f:]+): "
r"icmp_seq=(?P<seq>\d+) ttl=(?P<ttl>\d+) "
r"(rssi=(?P<rssi>-?\d+) dBm )?"
r"time=(?P<rtt>\d+.\d+) ms",
r"(?P<tx>\d+) packets transmitted, "
r"(?P<rx>\d+) packets received, "
r"(?P<packet_loss>\d+)% packet loss"])
if res == 0:
res._add_reply(term.match.groupdict())
res._add_reply(self._match.groupdict())
else:
res._set_stats(term.match.groupdict())
res._set_stats(self._match.groupdict())
break
term.expect(r"round-trip min/avg/max = (?P<min>\d+.\d+)/"
r"(?P<avg>\d+.\d+)/(?P<max>\d+.\d+) ms")
res._set_rtts(term.match.groupdict())
self._expect(r"round-trip min/avg/max = (?P<min>\d+.\d+)/"
r"(?P<avg>\d+.\d+)/(?P<max>\d+.\d+) ms")
res._set_rtts(self._match.groupdict())
return res

0 comments on commit b341d39

Please sign in to comment.