X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=a1%2Fcontroller.py;h=cde7483404412df90ff69afcfe03459e0547021f;hb=refs%2Fchanges%2F07%2F1907%2F13;hp=1022320e6165b7cc49e4d165314dce1b578ba051;hpb=a7672bf2165fe43e7dab1db8a41434fa6e610cc7;p=ric-plt%2Fa1.git diff --git a/a1/controller.py b/a1/controller.py index 1022320..cde7483 100644 --- a/a1/controller.py +++ b/a1/controller.py @@ -17,7 +17,6 @@ Main a1 controller # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================== -import json from flask import Response from jsonschema import validate from jsonschema.exceptions import ValidationError @@ -45,18 +44,6 @@ def _try_func_return(func): return Response(status=500) -def _gen_body_to_handler(operation, policy_type_id, policy_instance_id, payload=None): - """ - used to create the payloads that get sent to downstream policy handlers - """ - return { - "operation": operation, - "policy_type_id": policy_type_id, - "policy_instance_id": policy_instance_id, - "payload": payload, - } - - # Healthcheck @@ -164,9 +151,8 @@ def create_or_replace_policy_instance(policy_type_id, policy_instance_id): # store the instance data.store_policy_instance(policy_type_id, policy_instance_id, instance) - # send rmr (best effort) - body = _gen_body_to_handler("CREATE", policy_type_id, policy_instance_id, payload=instance) - a1rmr.queue_work({"payload": json.dumps(body), "ptid": policy_type_id}) + # queue rmr send (best effort) + a1rmr.queue_instance_send(("CREATE", policy_type_id, policy_instance_id, instance)) return "", 202 @@ -185,9 +171,8 @@ def delete_policy_instance(policy_type_id, policy_instance_id): """ data.delete_policy_instance(policy_type_id, policy_instance_id) - # send rmr (best effort) - body = _gen_body_to_handler("DELETE", policy_type_id, policy_instance_id) - a1rmr.queue_work({"payload": json.dumps(body), "ptid": policy_type_id}) + # queue rmr send (best effort) + a1rmr.queue_instance_send(("DELETE", policy_type_id, policy_instance_id, "")) return "", 202