Add dynamic timestamp
[ric-plt/e2mgr.git] / Automation / Tests / Scripts / loadscripts.py
1 ##############################################################################
2 #
3 #   Copyright (c) 2019 AT&T Intellectual Property.
4 #
5 #   Licensed under the Apache License, Version 2.0 (the "License");
6 #   you may not use this file except in compliance with the License.
7 #   You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #   Unless required by applicable law or agreed to in writing, software
12 #   distributed under the License is distributed on an "AS IS" BASIS,
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #   See the License for the specific language governing permissions and
15 #   limitations under the License.
16 #
17 ##############################################################################
18
19
20 import redis
21 import config
22
23 def getRedisClient():
24
25     c = config.redis_ip_address
26
27     p = config.redis_ip_port
28
29     return redis.Redis(host=c, port=p, db=0)
30
31
32 def verify_value():
33
34     r = getRedisClient()
35
36     value = "\b\x98\xf7\xdd\xa3\xc7\xb4\x83\xde\x15\x12\x11\n\x0f02f829:0007ab00"
37
38     if r.get("{e2Manager},LOAD:test1") != value:
39         return True
40     else:
41         return False
42
43
44 def add():
45
46     r = getRedisClient()
47
48     r.set("{e2Manager},LOAD:test1", "\b\x98\xf7\xdd\xa3\xc7\xb4\x83\xde\x15\x12\x11\n\x0f02f829:0007ab00")
49
50     if r.exists("{e2Manager},LOAD:test1"):
51         return True
52     else:
53         return False
54
55
56 def verify():
57
58     r = getRedisClient()
59
60     if r.exists("{e2Manager},LOAD:test1"):
61         return True
62     else:
63         return False
64