X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=Automation%2FTests%2FScripts%2Fcleanup_db.py;fp=Automation%2FTests%2FScripts%2Fcleanup_db.py;h=8e59c428a2c5d16a74870621be57a9f51e574bdc;hb=ef8e7b290c648ce0655c0fc0e8d0882fe31f2abc;hp=979da9a75bebd1424a94739b49d1a2bfeb1681da;hpb=a3606342337faa83791d41be3a94a7957d8f6ed5;p=ric-plt%2Fe2mgr.git diff --git a/Automation/Tests/Scripts/cleanup_db.py b/Automation/Tests/Scripts/cleanup_db.py index 979da9a..8e59c42 100644 --- a/Automation/Tests/Scripts/cleanup_db.py +++ b/Automation/Tests/Scripts/cleanup_db.py @@ -22,23 +22,27 @@ import config import redis import time +import k8s_helper -def flush(): - +def flush(set_new_timestamp): c = config.redis_ip_address p = config.redis_ip_port - r = redis.Redis(host=c, port=p, db=0) - - r.flushall() - r.set("{e2Manager},GENERAL","{\"enableRic\":true}") - r.set("{e2Manager},E2TAddresses", "[\"10.0.2.15:38000\"]") - r.set("{e2Manager},E2TInstance:10.0.2.15:38000","{\"address\":\"10.0.2.15:38000\",\"associatedRanList\":[],\"keepAliveTimestamp\":" + str(int((time.time()+2) * 1000000000)) + ",\"state\":\"ACTIVE\",\"deletionTimeStamp\":0}") - - return True + r = redis.Redis(host=c, port=p, db=0, ) + e2t_ip = k8s_helper.extract_service_ip("e2term-rmr-alpha") + et2_address = e2t_ip + ":38000" + r.flushall() + r.set("{e2Manager},GENERAL", "{\"enableRic\":true}") + r.set("{e2Manager},E2TAddresses", "[\"{}\"]".format(et2_address)) + timestamp = str(int((time.time() + 2) * 1000000000)) if set_new_timestamp else str( + int((time.time() - 300) * 1000000000)) + r.set("{{e2Manager}},E2TInstance:{}".format(et2_address), + "{{\"address\":\"{}\",\"associatedRanList\":[],\"keepAliveTimestamp\":".format(et2_address) + timestamp + + ",\"state\":\"ACTIVE\",\"deletionTimeStamp\":0}") + return True