X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=a1%2Fa1rmr.py;h=d6bd6855c17365c68538862803b1136392cc6396;hb=refs%2Fchanges%2F36%2F3536%2F4;hp=771842a978feae899cbcd338bbbf01b6aefd75c9;hpb=102b89592db01d8361a754c11a85699e5d2e965c;p=ric-plt%2Fa1.git diff --git a/a1/a1rmr.py b/a1/a1rmr.py index 771842a..d6bd685 100644 --- a/a1/a1rmr.py +++ b/a1/a1rmr.py @@ -1,6 +1,3 @@ -""" -a1s rmr functionality -""" # ================================================================================== # Copyright (c) 2019-2020 Nokia # Copyright (c) 2018-2020 AT&T Intellectual Property. @@ -17,12 +14,15 @@ a1s rmr functionality # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================== +""" +A1 RMR functionality +""" import os import queue import time import json from threading import Thread -from rmr import rmr, helpers +from ricxappframe.rmr import rmr, helpers from mdclogpy import Logger from a1 import data, messages from a1.exceptions import PolicyTypeNotFound, PolicyInstanceNotFound @@ -43,11 +43,27 @@ __RMR_LOOP__ = None class _RmrLoop: """ - class represents an rmr loop that constantly reads from rmr and performs operations based on waiting messages - this launches a thread, it should probably only be called once; the public facing method to access these ensures this + Class represents an rmr loop that constantly reads from rmr and performs operations + based on waiting messages. This launches a thread, it should probably only be called + once; the public facing method to access these ensures this. + + TODO: the xapp frame has a version of this looping structure. See if A1 can switch to that. """ def __init__(self, init_func_override=None, rcv_func_override=None): + """ + Init + + Parameters + ---------- + init_func_override: function (optional) + Function that initializes RMR and answers an RMR context. + Supply an empty function to skip initializing RMR. + + rcv_func_override: function (optional) + Function that receives messages from RMR and answers a list. + Supply a trivial function to skip reading from RMR. + """ self.keep_going = True self.rcv_func = None self.last_ran = time.time() @@ -197,6 +213,16 @@ class _RmrLoop: def start_rmr_thread(init_func_override=None, rcv_func_override=None): """ Start a1s rmr thread + + Parameters + ---------- + init_func_override: function (optional) + Function that initializes RMR and answers an RMR context. + Supply an empty function to skip initializing RMR. + + rcv_func_override: function (optional) + Function that receives messages from RMR and answers a list. + Supply a trivial function to skip reading from RMR. """ global __RMR_LOOP__ if __RMR_LOOP__ is None: