X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=test%2Ftools%2Ffastbgp%2Fplay.py;fp=test%2Ftools%2Ffastbgp%2Fplay.py;h=47a801da2ffc55b18d8aaab1aab678ca8fe9f1e6;hb=cc36b6e84076204e10fc56d1b0c8b020ded2eb81;hp=d42176ac09fa38ed33c6b2b8fe9ce7781a07b465;hpb=d218a0def7d735bee748428e0fe465cc19a6190a;p=integration%2Ftest.git diff --git a/test/tools/fastbgp/play.py b/test/tools/fastbgp/play.py index d42176ac09..47a801da2f 100644 --- a/test/tools/fastbgp/play.py +++ b/test/tools/fastbgp/play.py @@ -95,8 +95,17 @@ class MessageError(ValueError): super(MessageError, self).__init__(text, message, *args) def __str__(self): - """Concatenate text comment, space and hexlified message.""" - return self.text + ' ' + binascii.hexlify(self.msg) + """ + Generate human readable error message + + Concatenate text comment, colon with space + and hexlified message. Use a placeholder string + if the message turns out to be empty. + """ + message = binascii.hexlify(self.msg) + if message == "": + message = "(empty message)" + return self.text + ': ' + message def read_open_message(bgp_socket):