6 class PrhLibrary(object):
12 def check_for_log(search_for):
13 client = docker.from_env()
14 container = client.containers.get('prh')
15 for line in container.logs(stream=True):
16 if search_for in line.strip():
22 def create_pnf_ready_notification(json_file):
23 json_to_python = json.loads(json_file)
24 ipv4 = json_to_python["event"]["pnfRegistrationFields"]["oamV4IpAddress"]
25 ipv6 = json_to_python["event"]["pnfRegistrationFields"]["oamV6IpAddress"]
26 header = json_to_python["event"]["commonEventHeader"]["sourceName"]
27 str_json = '{"sourceName":"' + header + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}'
28 python_to_json = json.dumps(str_json)
29 return python_to_json.replace("\\", "")[1:-1]
32 def create_pnf_name(json_file):
33 json_to_python = json.loads(json_file)
34 header = json_to_python["event"]["commonEventHeader"]["sourceName"]
39 client = docker.from_env()
40 container = client.containers.get('aai_simulator')
43 def create_invalid_notification(self, json_file):
44 return self.create_pnf_ready_notification(json_file).replace("\":", "\": ")\
45 .replace("ipaddress-v4-oam", "oamV4IpAddress").replace("ipaddress-v6-oam", "oamV6IpAddress")\
46 .replace("}", "\\\\n}")