play_ methods apply to test/tool/fastbgp/play.py (only with --evpn used)
"""
+import re
import xmlrpclib
class BgpRpcClient(object):
"""The client for SimpleXMLRPCServer."""
- def __init__(self, peer_addr):
+ def __init__(self, peer_addr, port=8000):
"""Setup destination point of the rpc server"""
- self.proxy = xmlrpclib.ServerProxy("http://{}:8000".format(peer_addr))
+ self.proxy = xmlrpclib.ServerProxy("http://{}:{}".format(peer_addr, port))
def exa_announce(self, full_exabgp_cmd):
"""The full command to be passed to exabgp."""
def play_clean(self, what='update'):
"""Cleans the message (update) on the server."""
return self.proxy.clean(what)
+
+ def sum_hex_message(self, hex_string):
+ """Verifies two hex messages are equal even in case, their arguments are misplaced.
+ Converts hex message arguments to integers and sums them up and returns the sum."""
+ return sum(map(lambda x: int(x, 16), re.compile('[a-f\d]{2}').findall(hex_string[32:])))