1 from ONAPLibrary.VESProtobuf import *
2 from ONAPLibrary.JSONKeywords import JSONKeywords
3 from robot.api.deco import keyword
6 class ProtobufKeywords(object):
7 """ Utilities useful for Protobuf manipulation """
10 super(ProtobufKeywords, self).__init__()
11 self.vpf = VESProtobuf()
14 def compare_file_to_message(self, file_name, message):
15 with open(file_name, "rb") as file_to_do:
16 return self.compare_two_messages(file_to_do.read(), message)
18 def compare_two_messages(self, left, right):
19 left_json = self.vpf.binary_to_json(left)
20 right_json = self.vpf.binary_to_json(right)
21 return JSONKeywords().json_equals(left_json, right_json)