Fix two bugs in simulator & code cleaning
[sim/a1-interface.git] / near-rt-ric-simulator / src / OSC_2.1.0 / a1.py
index eb4209c..59c47ef 100644 (file)
@@ -46,7 +46,9 @@ def get_all_policy_types():
   if ((r := check_modified_response()) is not None):
     return r
 
-  return (list(policy_instances.keys()), 200)
+  res = list(policy_instances.keys())
+  res = list(map(int, res))
+  return (res, 200)
 
 # API Function: Get a policy type
 def get_policy_type(policy_type_id):
@@ -93,6 +95,11 @@ def create_policy_type(policy_type_id):
   if ((r := check_modified_response()) is not None):
     return r
 
+  try:
+    val=int(policy_type_id)
+  except:
+    return Response("The policy type id is not an int", 400, mimetype='text/plain')
+
   policy_type_id=str(policy_type_id)
 
   if (policy_type_id in policy_instances.keys()):