From: maximesson Date: Mon, 24 Feb 2020 16:15:50 +0000 (+0100) Subject: Fix code error simulator X-Git-Tag: 2.0.0~153^2 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=e3954c482a1c1b395b13e95b1cff66c8e793e517;p=nonrtric.git Fix code error simulator Change-Id: Ie94ed551e68cc6bb764aaaccb0ed824554392b91 Issue-ID: NONRTRIC-78 Signed-off-by: maximesson --- diff --git a/docs/developer-guide.rst b/docs/developer-guide.rst index 910bb8d5..b3651f43 100644 --- a/docs/developer-guide.rst +++ b/docs/developer-guide.rst @@ -73,7 +73,7 @@ Prerequisites Build and run ------------- -Go to the near-rt-ric-simulator/ directory and run this command:: +Go to the near-rt-ric-simulator/ric-plt-a1/ directory and run this command:: mvn clean install The docker image can be built using:: docker build -t {desiredImageName} . @@ -84,6 +84,9 @@ The functions written in *a1.py* are the ones matching the requests listed in th Different error codes can be thrown back according to the yaml file. In order to simulate an error code, simply add the query ?code={desiredCodeNumber} at the end of the address in the curl request. +For running the simulator outside of a docker container, run ./run_me.sh. It is possible to use the port of your choice, by adding it in the command: ./run_me.sh {desiredPort}. +After that, it is the exact same use with or without a container. + End-to-end call =============== diff --git a/near-rt-ric-simulator/ric-plt/a1/a1.py b/near-rt-ric-simulator/ric-plt/a1/a1.py index 76f51b83..7f77781a 100644 --- a/near-rt-ric-simulator/ric-plt/a1/a1.py +++ b/near-rt-ric-simulator/ric-plt/a1/a1.py @@ -53,6 +53,11 @@ def put_policy(policyId): if 'code' in request.args: return(send_error_code(request.args)) + if policyId in policy_instances.keys(): + code = 201 + else: + code = 200 + policy_instances[policyId] = data policy_status[policyId] = set_status("UNDEFINED") if 'policyTypeId' in request.args: @@ -65,11 +70,6 @@ def put_policy(policyId): else: policy_type_per_instance[policyId] = "UNDEFINED" - if policyId in policy_instances.keys(): - code = 201 - else: - code = 200 - response = make_response(policy_instances[policyId], code) if code == 201: response.headers['Location'] = "http://localhost:8085/A1-P/v1/policies/" + policyId