From b6de6dce778aa96318e903495a25aa2fd2a16d2e Mon Sep 17 00:00:00 2001 From: Andreas Strikos Date: Tue, 15 Dec 2015 13:52:06 +0100 Subject: [PATCH 1/4] make sure generic errors on hop level are included on last_hop_errors --- ripe/atlas/sagan/traceroute.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ripe/atlas/sagan/traceroute.py b/ripe/atlas/sagan/traceroute.py index 466e6f5..8f72159 100644 --- a/ripe/atlas/sagan/traceroute.py +++ b/ripe/atlas/sagan/traceroute.py @@ -176,7 +176,11 @@ def set_is_success(self, last_hop): self.set_last_hop_errors(last_hop) def set_last_hop_errors(self, last_hop): - """Sets the last hop's errors..""" + """Sets the last hop's errors.""" + if last_hop.is_error: + self.last_hop_errors.append(last_hop.error_message) + return + for packet in last_hop.packets: if packet.is_error: self.last_hop_errors.append(packet.error_message) From a83e597f7ef756a9239f5f8fcac8d8b667185022 Mon Sep 17 00:00:00 2001 From: Andreas Strikos Date: Tue, 15 Dec 2015 14:04:06 +0100 Subject: [PATCH 2/4] set last_median_rtt only once --- ripe/atlas/sagan/traceroute.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ripe/atlas/sagan/traceroute.py b/ripe/atlas/sagan/traceroute.py index 8f72159..0e79e77 100644 --- a/ripe/atlas/sagan/traceroute.py +++ b/ripe/atlas/sagan/traceroute.py @@ -213,9 +213,6 @@ def _parse_hops(self, **kwargs): hop = Hop(hop, **kwargs) - if hop.median_rtt: - self.last_median_rtt = hop.median_rtt - self.hops.append(hop) self.total_hops += 1 @@ -225,6 +222,9 @@ def _parse_hops(self, **kwargs): self.set_last_hop_responded(hop) self.set_is_success(hop) + if hop.median_rtt: + self.last_median_rtt = hop.median_rtt + __all__ = ( "TracerouteResult", From 72630b32d4de0940ada7364f98867307da4965ca Mon Sep 17 00:00:00 2001 From: Andreas Strikos Date: Tue, 15 Dec 2015 14:04:26 +0100 Subject: [PATCH 3/4] update docs with new traceroute features --- docs/types.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/types.rst b/docs/types.rst index 2becca4..eb0ee9d 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -96,9 +96,11 @@ protocol str One of ``ICMP``, ``TCP``, ``UDP`` hops list A list of :ref:`traceroute-hop` objects total_hops int The total number of hops ip_path list A list of dicts containing the IPs at each hop. This is just for convenience as all of these values are accessible via the :ref:`traceroute-hop` and :ref:`traceroute-packet` objects. -last_rtt float The RTT from the last successful hop +last_median_rtt float The median value of all RTTs from the last successful hop destination_ip_responded bool Set to ``True`` if the last hop was a response from the destination IP last_hop_responded bool Set to ``True`` if the last hop was a response at all +is_success bool Set to ``True`` if the traceroute finished successfully +last_hop_errors list A list of last hop's errors ======================== ======== =================================================================================== @@ -114,6 +116,7 @@ Property Type Explanation ===================== ===== ================================================================ index int The hop number, starting with 1 packets list A list of tracroute :ref:`traceroute-packet` objects +median_rtt float The median value of all RTTs of the hop ===================== ===== ================================================================ From 093c057d3612a7d7338e263e041f230295eb154e Mon Sep 17 00:00:00 2001 From: Andreas Strikos Date: Tue, 15 Dec 2015 14:21:37 +0100 Subject: [PATCH 4/4] Bring back the old behavior of the property --- ripe/atlas/sagan/traceroute.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ripe/atlas/sagan/traceroute.py b/ripe/atlas/sagan/traceroute.py index 0e79e77..8f72159 100644 --- a/ripe/atlas/sagan/traceroute.py +++ b/ripe/atlas/sagan/traceroute.py @@ -213,6 +213,9 @@ def _parse_hops(self, **kwargs): hop = Hop(hop, **kwargs) + if hop.median_rtt: + self.last_median_rtt = hop.median_rtt + self.hops.append(hop) self.total_hops += 1 @@ -222,9 +225,6 @@ def _parse_hops(self, **kwargs): self.set_last_hop_responded(hop) self.set_is_success(hop) - if hop.median_rtt: - self.last_median_rtt = hop.median_rtt - __all__ = ( "TracerouteResult",