X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=a1%2Fdata.py;h=ca0acb37fb1c3a46c31053aa072cc54c0072160b;hb=fe30c1726c397b1ee100cd3d3795758e7d21b6bf;hp=45fe5de204e27f52d529fb8a9c671b6f367ac072;hpb=45f8f98f0e344cc253d709df23bf27311adff0bb;p=ric-plt%2Fa1.git diff --git a/a1/data.py b/a1/data.py index 45fe5de..ca0acb3 100644 --- a/a1/data.py +++ b/a1/data.py @@ -1,6 +1,3 @@ -""" -Represents A1s database and database access functions. -""" # ================================================================================== # Copyright (c) 2019-2020 Nokia # Copyright (c) 2018-2020 AT&T Intellectual Property. @@ -17,6 +14,9 @@ Represents A1s database and database access functions. # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================== +""" +Represents A1s database and database access functions. +""" import os import time from threading import Thread @@ -24,7 +24,6 @@ from mdclogpy import Logger from ricxappframe.xapp_sdl import SDLWrapper from a1.exceptions import PolicyTypeNotFound, PolicyInstanceNotFound, PolicyTypeAlreadyExists, CantDeleteNonEmptyType - # constants INSTANCE_DELETE_NO_RESP_TTL = int(os.environ.get("INSTANCE_DELETE_NO_RESP_TTL", 5)) INSTANCE_DELETE_RESP_TTL = int(os.environ.get("INSTANCE_DELETE_RESP_TTL", 5)) @@ -166,6 +165,8 @@ def store_policy_type(policy_type_id, body): key = _generate_type_key(policy_type_id) if SDL.get(A1NS, key) is not None: raise PolicyTypeAlreadyExists() + # overwrite ID in body to enforce consistency + body['policy_type_id'] = policy_type_id SDL.set(A1NS, key, body)