From 87210c1cb74436c93d79e2381ef5c6b702ac6aff Mon Sep 17 00:00:00 2001 From: Dipti Date: Sat, 20 Feb 2021 14:35:24 -0800 Subject: [PATCH] changed logic for var_time, improved error message for incorrect monitor_interval input Signed-off-by: Dipti --- py-json/LANforge/lfcli_base.py | 4 ++-- py-json/realm.py | 2 +- py-scripts/test_ipv4_variable_time.py | 12 ++++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/py-json/LANforge/lfcli_base.py b/py-json/LANforge/lfcli_base.py index aad7121a..77c71ac6 100644 --- a/py-json/LANforge/lfcli_base.py +++ b/py-json/LANforge/lfcli_base.py @@ -645,8 +645,8 @@ class LFCliBase: dataframe_two = dataframe_two.drop(list(cols_to_remove), axis=1) #for time elapsed section and endpoint name combo # - print(dataframe_one) - print(dataframe_two) + #print(dataframe_one) + #print(dataframe_two) #take those columns and separate those columns from others in DF. diff --git a/py-json/realm.py b/py-json/realm.py index 04fc0c49..28718707 100755 --- a/py-json/realm.py +++ b/py-json/realm.py @@ -684,7 +684,7 @@ class Realm(LFCliBase): else: duration_time = datetime.timedelta(seconds=dur_time) else: - raise ValueError("Unknown value for time_string: %s" % time_string) + raise ValueError("Cannot compute time string provided: %s" % time_string) else: raise ValueError("time_string must be of type str. Type %s provided" % type(time_string)) return duration_time diff --git a/py-scripts/test_ipv4_variable_time.py b/py-scripts/test_ipv4_variable_time.py index 04324a5b..45bc0d39 100755 --- a/py-scripts/test_ipv4_variable_time.py +++ b/py-scripts/test_ipv4_variable_time.py @@ -344,7 +344,7 @@ python3 ./test_ipv4_variable_time.py if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) ip_var_test.exit_fail() - ip_var_test.start(False, False) + try: layer3connections = ','.join([[*x.keys()][0] for x in ip_var_test.json_get('endp')['endpoint']]) @@ -368,9 +368,13 @@ python3 ./test_ipv4_variable_time.py print(layer3_cols) print("Port Manager column names are...") print(port_mgr_cols) - - monitor_interval = Realm.parse_time(args.monitor_interval).total_seconds() - + try: + monitor_interval = Realm.parse_time(args.monitor_interval).total_seconds() + except ValueError as error: + print(str(error)) + print(ValueError("The time string provided for monitor_interval argument is invalid. Please see supported time stamp increments and inputs for monitor_interval in --help. ")) + exit(1) + ip_var_test.start(False, False) ip_var_test.l3cxprofile.monitor(layer3_cols=layer3_cols, sta_list=station_list, port_mgr_cols=port_mgr_cols,