Fix code error simulator 63/2563/3
authormaximesson <maxime.bonneau@est.tech>
Mon, 24 Feb 2020 16:15:50 +0000 (17:15 +0100)
committermaximesson <maxime.bonneau@est.tech>
Mon, 2 Mar 2020 08:55:39 +0000 (09:55 +0100)
Change-Id: Ie94ed551e68cc6bb764aaaccb0ed824554392b91
Issue-ID: NONRTRIC-78
Signed-off-by: maximesson <maxime.bonneau@est.tech>
docs/developer-guide.rst
near-rt-ric-simulator/ric-plt/a1/a1.py

index 910bb8d..b3651f4 100644 (file)
@@ -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
 ===============
 
index 76f51b8..7f77781 100644 (file)
@@ -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