additions to ipv4_l4_url monitor

This commit is contained in:
Dipti
2021-01-22 14:24:30 -08:00
committed by Jed Reynolds
parent 2c78b4b427
commit f09f31ca52
2 changed files with 18 additions and 9 deletions

View File

@@ -1679,7 +1679,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:
@@ -1705,12 +1706,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,
@@ -1718,6 +1719,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
@@ -1726,21 +1731,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")

View File

@@ -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())