-import msgpack
-from a1.exceptions import PolicyTypeNotFound, PolicyInstanceNotFound, PolicyTypeAlreadyExists, CantDeleteNonEmptyType
-from a1 import get_module_logger
-
-logger = get_module_logger(__name__)
-
-
-class SDLWrapper:
- """
- This is a wrapper around the expected SDL Python interface.
- The usage of POLICY_DATA will be replaced with SDL when SDL for python is available.
- The eventual SDL API is expected to be very close to what is here.
-
- We use msgpack for binary (de)serialization: https://msgpack.org/index.html
- """
-
- def __init__(self):
- self.POLICY_DATA = {}
-
- def set(self, key, value):
- """set a key"""
- self.POLICY_DATA[key] = msgpack.packb(value, use_bin_type=True)
-
- def get(self, key):
- """get a key"""
- if key in self.POLICY_DATA:
- return msgpack.unpackb(self.POLICY_DATA[key], raw=False)
- return None
-
- def find_and_get(self, prefix):
- """get all k v pairs that start with prefix"""
- return {k: msgpack.unpackb(v, raw=False) for k, v in self.POLICY_DATA.items() if k.startswith(prefix)}
-
- def delete(self, key):
- """ delete a key"""
- del self.POLICY_DATA[key]
-
-
-SDL = SDLWrapper()
-
+import distutils.util
+import os
+import time
+from threading import Thread
+from mdclogpy import Logger
+from ricxappframe.xapp_sdl import SDLWrapper
+from a1.exceptions import PolicyTypeNotFound, PolicyInstanceNotFound, PolicyTypeAlreadyExists, PolicyTypeIdMismatch, 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))
+USE_FAKE_SDL = bool(distutils.util.strtobool(os.environ.get("USE_FAKE_SDL", "False")))
+A1NS = "A1m_ns"