[RICPLT-1898] - Replace http router to gorilla-mux + UT + Automation code
[ric-plt/e2mgr.git] / Automation / Tests / Get-All-Nodes / scripts.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 import config
20 import redis
21
22
23 def flush():
24
25     c = config.redis_ip_address
26
27     p = config.redis_ip_port
28
29     r = redis.Redis(host=c, port=p, db=0)
30
31     r.flushall()
32
33     return True
34
35
36 def add():
37
38     c = config.redis_ip_address
39
40     p = config.redis_ip_port
41
42     r = redis.Redis(host=c, port=p, db=0)
43
44     r.flushall()
45
46     r.set("{e2Manager},ENB:02f829:007a80", "\n\x05test1\x12\t10.0.2.15\x18\xc9+ \x01*\x10\n\x0602f829\x12\x06007a800\x01:3\b\x01\x12/\bc\x12\x0f02f829:0007ab50\x1a\x040102\"\x0602f829*\n\n\b\b\x01\x10\x01\x18\x04 \x040\x01")
47
48     r.set("{e2Manager},RAN:test1","\x12\t10.0.2.15\x18\xc9+ \x03H\x01R\x02\b\t")
49
50     r.set("{e2Manager},PCI:test1:63" , "\b\x01\x12/\bc\x12\x0f02f829:0007ab50\x1a\x040102\"\x0602f829*\n\n\b\b\x01\x10\x01\x18\x04 \x040\x01")
51
52     r.set("{e2Manager},CELL:02f829:0007ab50" ,  "\b\x01\x12/\bc\x12\x0f02f829:0007ab50\x1a\x040102\"\x0602f829*\n\n\b\b\x01\x10\x01\x18\x04 \x040\x01")
53
54     r.sadd("{e2Manager},ENB" , "\n\x05test1\x12\x10\n\x0602f829\x12\x06007a80")
55
56
57     r.set("{e2Manager},GNB:03f829:002234", "\n\x05test2\x12\t10.0.2.16\x18\xc9+ \x01*\x10\n\x0702f829\x12\x070012340\x02BI\nG\nE\bc\x12\x1102f829:0008ab0120*\x0602f8290\x01:$\n\"\n\t\bd\"\x05\b\t\x12\x01\t\x12\t\bd\"\x05\b\t\x12\x01\t\x1a\x04\b\x01\x10\x01\"\x04\b\x01\x10\x01")
58
59     r.set("{e2Manager},RAN:test2", "\n\x05test2\x12\t10.0.2.15\x18\xc9+ \x01*\x10\n\x0702f829\x12\x070012340\x03BI\nG\nE\bc\x12\x1103f829:0008ab0120*\x0602f8290\x01:$\n\"\n\t\bd\"\x05\b\t\x12\x01\t\x12\t\bd\"\x05\b\t\x12\x01\t\x1a\x04\b\x01\x10\x01\"\x04\b\x01\x10\x01")
60
61     r.set("{e2Manager},PCI:test2:63", "\b\x02\x1aG\nE\bc\x12\x1102f829:0008ab0120*\x0702f8290\x01:$\n\"\n\t\bd\"\x05\b\t\x12\x01\t\x12\t\bd\"\x05\b\t\x12\x01\t\x1a\x04\b\x01\x10\x01\"\x04\b\x01\x10\x01")
62
63     r.set("{e2Manager},NRCELL:02f829:0007ab0120", "\b\x02\x1aG\nE\bc\x12\x1102f829:0007ab0120*\x0602f8290\x01:$\n\"\n\t\bd\"\x05\b\t\x12\x01\t\x12\t\bd\"\x05\b\t\x12\x01\t\x1a\x04\b\x01\x10\x01\"\x04\b\x01\x10\x01")
64
65     r.sadd("{e2Manager},GNB","\n\x05test2\x12\x10\n\x0603f829\x12\x06001234")
66
67     return True