X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FDropRateSearch.py;h=aead532da05933522973142396832cb56f7462a4;hb=80e71dac74145241aef844491ebf21cc486d4a23;hp=1f8e5618fe761d33c3fc9ee0370064f2d7d035d8;hpb=f94e16167519c74707ec8b606da3f7b97c749c66;p=csit.git diff --git a/resources/libraries/python/DropRateSearch.py b/resources/libraries/python/DropRateSearch.py index 1f8e5618fe..aead532da0 100644 --- a/resources/libraries/python/DropRateSearch.py +++ b/resources/libraries/python/DropRateSearch.py @@ -98,6 +98,15 @@ class DropRateSearch(object): self._search_result = None self._search_result_rate = None + @abstractmethod + def get_latency(self): + """Return min/avg/max latency. + + :return: Latency stats. + :rtype: list + """ + pass + @abstractmethod def measure_loss(self, rate, frame_size, loss_acceptance, loss_acceptance_type, traffic_type): @@ -346,7 +355,7 @@ class DropRateSearch(object): :rtype: boolean """ # Return False if not all elements of the iterable are True. - return not all(res_list) + return all(res_list) def _get_res_based_on_search_type(self, res_list): """Return result of search based on search evaluation type. @@ -453,14 +462,14 @@ class DropRateSearch(object): def verify_search_result(self): """Fail if search was not successful. - :return: Result rate. - :rtype: float + :return: Result rate and latency stats. + :rtype: tuple """ if self._search_result == SearchResults.FAILURE: raise Exception('Search FAILED') elif self._search_result in [SearchResults.SUCCESS, SearchResults.SUSPICIOUS]: - return self._search_result_rate + return self._search_result_rate, self.get_latency() def binary_search(self, b_min, b_max, traffic_type, skip_max_rate=False): """Binary search of rate with loss below acceptance criteria.