X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=integration_tests%2Freceiver.py;h=5c3ceaf812bb8330f8fc6af198ca0516e2f3bf4b;hb=445221bb8e531d77aad987b936b30d385521134f;hp=f1c324f779f52e264091aba7ebf746890c15035f;hpb=30a7bdce9115e6bba8811edae2fc949e404021da;p=ric-plt%2Fa1.git diff --git a/integration_tests/receiver.py b/integration_tests/receiver.py index f1c324f..5c3ceaf 100644 --- a/integration_tests/receiver.py +++ b/integration_tests/receiver.py @@ -27,8 +27,7 @@ PORT = os.environ.get("TEST_RCV_PORT", "4560") DELAY = int(os.environ.get("TEST_RCV_SEC_DELAY", 0)) HANDLER_ID = os.environ.get("HANDLER_ID", "test_receiver") -# TODO: should these be made constants? -mrc = rmr.rmr_init(PORT.encode("utf-8"), rmr.RMR_MAX_RCV_BYTES, 0x00) +mrc = rmr.rmr_init(PORT.encode("utf-8"), rmr.RMR_MAX_RCV_BYTES, rmr.RMRFL_MTCALL) while rmr.rmr_ready(mrc) == 0: time.sleep(1) @@ -36,7 +35,7 @@ while rmr.rmr_ready(mrc) == 0: print("listening ON {}".format(PORT)) while True: - sbuf = rmr.rmr_alloc_msg(mrc, 4096) + sbuf = rmr.rmr_alloc_msg(mrc, 10) sbuf = rmr.rmr_torcv_msg(mrc, sbuf, 1000) summary = rmr.message_summary(sbuf) if summary["message state"] == 12 and summary["message status"] == "RMR_ERR_TIMEOUT": @@ -47,16 +46,23 @@ while True: received_payload = json.loads(summary["payload"]) + op = received_payload["operation"] + send_payload_status = "ERROR" + if op == "CREATE": + send_payload_status = "OK" + elif op == "DELETE": + send_payload_status = "DELETED" + payload = { "policy_type_id": received_payload["policy_type_id"], "policy_instance_id": received_payload["policy_instance_id"], "handler_id": HANDLER_ID, - "status": "OK", + "status": send_payload_status, } val = json.dumps(payload).encode("utf-8") rmr.set_payload_and_length(val, sbuf) - sbuf.contents.mtype = 21024 + sbuf.contents.mtype = 20011 print("Pre reply summary: {}".format(rmr.message_summary(sbuf))) time.sleep(DELAY)