X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=integration_tests%2Freceiver.py;h=fedc6901ceea953641eda41b2f286156e49538db;hb=0b42dfc507b22b49669f360883a1cecaa50cda7b;hp=0dc5e4a2ec61d17bf5be8694a8000c082b2bc325;hpb=148e2699cf55e5619d181c2e46e1f672456a4422;p=ric-plt%2Fa1.git diff --git a/integration_tests/receiver.py b/integration_tests/receiver.py index 0dc5e4a..fedc690 100644 --- a/integration_tests/receiver.py +++ b/integration_tests/receiver.py @@ -27,16 +27,15 @@ 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) print("not yet ready") print("listening ON {}".format(PORT)) -sbuf = None while True: + 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,11 +46,18 @@ 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")