From d5801e449ca4c7115c2c11bf164bcce7b149917c Mon Sep 17 00:00:00 2001 From: Luc Provoost Date: Tue, 8 Dec 2020 21:53:41 +0100 Subject: Reporting test details for all tests Test details were only implemented in rapid_flowsizetest.py. When executing other tests, an error occured. That is now fixed, although in some cases, None is returned. The format.yaml files defines now alsowhat will be reported in the Xtesting details. Change-Id: I5feae62dcf228664b24451d3fc5dfaaadf7edb5e Signed-off-by: Luc Provoost --- VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py | 26 ++++++++--------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py') diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py index 73b41a6f..b89eb7bc 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py @@ -114,29 +114,21 @@ class RapidTest(object): def post_data(self, test, variables): var = copy.deepcopy(self.data_format) self.parse_data_format_dict(var, variables) - if 'URL' not in var.keys(): - return - if test not in var.keys(): - return - URL='' - for value in var['URL'].values(): - URL = URL + value - HEADERS = {'X-Requested-With': 'Python requests', 'Content-type': 'application/rapid'} - if 'Format' in var.keys(): + if var.keys() >= {'URL', test, 'Format'}: + URL='' + for value in var['URL'].values(): + URL = URL + value + HEADERS = {'X-Requested-With': 'Python requests', 'Content-type': 'application/rapid'} if var['Format'] == 'PushGateway': data = "\n".join("{} {}".format(k, v) for k, v in var[test].items()) + "\n" response = requests.post(url=URL, data=data,headers=HEADERS) elif var['Format'] == 'Xtesting': data = var[test] response = requests.post(url=URL, json=data) - else: - return - else: - return - if (response.status_code != 202) and (response.status_code != 200): - RapidLog.info('Cannot send metrics to {}'.format(URL)) - RapidLog.info(data) - + if (response.status_code >= 300): + RapidLog.info('Cannot send metrics to {}'.format(URL)) + RapidLog.info(data) + return (var[test]) @staticmethod def report_result(flow_number, size, speed, pps_req_tx, pps_tx, pps_sut_tx, -- cgit 1.2.3-korg