diff --git a/py-json/realm.py b/py-json/realm.py index 3426276f..5d8cbb9c 100755 --- a/py-json/realm.py +++ b/py-json/realm.py @@ -1671,7 +1671,8 @@ class L4CXProfile(LFCliBase): output_format=None, script_name=None, arguments=None, - iterations=0): + iterations=0, + debug=False): try: duration_sec = self.parse_time(duration_sec).seconds except: @@ -1697,12 +1698,12 @@ class L4CXProfile(LFCliBase): if col_names is not None and len(col_names) > 0: fields = ",".join(col_names) header_row=col_names - if self.debug: + if debug: print(fields) else: #todo:rename this... header_row=list((list(self.json_get("/layer4/all")['endpoint'][0].values())[0].keys())) - if self.debug: + if debug: print(header_row) # Step 2, monitor columns, @@ -1710,6 +1711,10 @@ class L4CXProfile(LFCliBase): start_time = datetime.datetime.now() end_time = start_time + datetime.timedelta(seconds=duration_sec) sleep_interval = round(duration_sec // 5) + if debug: + print("Sleep_interval is..." + sleep_interval) + print("Start time is..."+ start_time) + print("End time is..."+ end_time) value_map = dict() passes = 0 expected_passes = 0 @@ -1718,21 +1723,22 @@ class L4CXProfile(LFCliBase): while datetime.datetime.now() < end_time: response=self.json_get("layer4/all") #response = self.json_get("layer4/list?fields=urls/s") - if self.debug: + if debug: print(response) if "endpoint" not in response: print(response) raise ValueError("Cannot find any endpoints") if monitor: - if self.debug: + if debug: print(response) - time.sleep(sleep_interval.total_seconds()) + + time.sleep(sleep_interval) t = datetime.datetime.now() timestamps.append(t) value_map[t] = response expected_passes += 1 - if self.cx_profile.check_errors(self.debug): - if self.__check_request_rate(): + if self.cx_profile.check_errors(debug): + if self.__check_request_rate(): #need to changed passes += 1 else: self._fail("FAIL: Request rate did not exceed 90% target rate") diff --git a/py-scripts/test_ipv4_l4_urls_per_ten.py b/py-scripts/test_ipv4_l4_urls_per_ten.py index f0dccc52..aec2585a 100755 --- a/py-scripts/test_ipv4_l4_urls_per_ten.py +++ b/py-scripts/test_ipv4_l4_urls_per_ten.py @@ -45,6 +45,7 @@ class IPV4L4(LFCliBase): self.url = url self.mode=mode self.ap=ap + self.debug=_debug_on self.requests_per_ten = int(requests_per_ten) self.number_template = number_template self.test_duration=test_duration @@ -209,6 +210,7 @@ python3 ./test_ipv4_l4_urls_per_ten.py url=args.url, mode=args.mode, ap=args.ap, + _debug_on=args.debug, test_duration=args.test_duration, num_tests=args.num_tests, target_requests_per_ten=args.target_per_ten, @@ -227,7 +229,8 @@ python3 ./test_ipv4_l4_urls_per_ten.py created_cx=layer4traffic, output_format=output_form, script_name='test_ipv4_l4_urls_per_ten', - arguments=args) + arguments=args, + debug=args.debug) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message())