X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fextract_sdnc_reply.py;h=5e37aa22ff4290d9f1d3dc965a95b6985768dc4c;hb=HEAD;hp=cb80e5e20a0ebdf699dd48d52bd7ca5561eb580b;hpb=acdd3f361ff7af58b0276789cc5148180a06e552;p=nonrtric.git diff --git a/test/common/extract_sdnc_reply.py b/test/common/extract_sdnc_reply.py index cb80e5e2..5e37aa22 100644 --- a/test/common/extract_sdnc_reply.py +++ b/test/common/extract_sdnc_reply.py @@ -20,20 +20,24 @@ import json import sys # Extract the response code and optional response message body from and SDNC A1 Controller API reply - +# Args: try: - with open(sys.argv[1]) as json_file: + with open(sys.argv[2]) as json_file: reply = json.load(json_file) - output=reply['output'] + output=reply[sys.argv[1]] status=str(output['http-status']) while(len(status) < 3): status="0"+status resp=status if ( 'body' in output.keys()): body=str(output['body']) - bodyJson=json.loads(body) - resp=str(json.dumps(bodyJson))+str(status) + try: + bodyJson=json.loads(body) + resp=str(json.dumps(bodyJson))+str(status) + except Exception as e1: + resp=body+str(status) + print(resp) except Exception as e: