X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=a1%2Fdata.py;fp=a1%2Fdata.py;h=436912f8a45e9bdf6ee83e5efe16b90167c6dce4;hb=e348b5507c24f599cf1560e928e3b3dfd07dc683;hp=a9301d8cf6a72414e0c4817481ff67b7ebee68b0;hpb=0123ec42ca49950f0a9ec95ed5d5ebbb0535fa89;p=ric-plt%2Fa1.git diff --git a/a1/data.py b/a1/data.py index a9301d8..436912f 100644 --- a/a1/data.py +++ b/a1/data.py @@ -204,8 +204,10 @@ def store_policy_instance(policy_type_id, policy_instance_id, instance): creation_timestamp = time.time() # store the instance + operation = "CREATE" key = _generate_instance_key(policy_type_id, policy_instance_id) if SDL.get(A1NS, key) is not None: + operation = "UPDATE" # Reset the statuses because this is a new policy instance, even if it was overwritten _clear_handlers(policy_type_id, policy_instance_id) # delete all the handlers SDL.set(A1NS, key, instance) @@ -213,6 +215,8 @@ def store_policy_instance(policy_type_id, policy_instance_id, instance): metadata_key = _generate_instance_metadata_key(policy_type_id, policy_instance_id) SDL.set(A1NS, metadata_key, {"created_at": creation_timestamp, "has_been_deleted": False}) + return operation + def get_policy_instance(policy_type_id, policy_instance_id): """