diff options
Diffstat (limited to 'resources/libraries/python/honeycomb/HoneycombSetup.py')
-rw-r--r-- | resources/libraries/python/honeycomb/HoneycombSetup.py | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/resources/libraries/python/honeycomb/HoneycombSetup.py b/resources/libraries/python/honeycomb/HoneycombSetup.py index 7c3831ca04..d4175b13e4 100644 --- a/resources/libraries/python/honeycomb/HoneycombSetup.py +++ b/resources/libraries/python/honeycomb/HoneycombSetup.py @@ -61,12 +61,13 @@ class HoneycombSetup(object): HoneycombSetup.print_environment(nodes) - logger.console("\n(re)Starting Honeycomb service ...") - cmd = "sudo service honeycomb start" for node in nodes: if node['type'] == NodeType.DUT: + logger.console( + "\n(re)Starting Honeycomb service on node {0}".format( + node["host"])) ssh = SSH() ssh.connect(node) (ret_code, _, _) = ssh.exec_command_sudo(cmd) @@ -89,13 +90,15 @@ class HoneycombSetup(object): :type nodes: list :raises HoneycombError: If Honeycomb failed to stop. """ - logger.console("\nShutting down Honeycomb service ...") cmd = "sudo service honeycomb stop" errors = [] for node in nodes: if node['type'] == NodeType.DUT: + logger.console( + "\nShutting down Honeycomb service on node {0}".format( + node["host"])) ssh = SSH() ssh.connect(node) (ret_code, _, _) = ssh.exec_command_sudo(cmd) @@ -121,7 +124,8 @@ class HoneycombSetup(object): :raises HoneycombError: If Honeycomb fails to start. """ - logger.console("\n(re)Starting Honeycomb service ...") + logger.console( + "\n(re)Starting Honeycomb service on node {0}".format(node["host"])) cmd = "sudo service honeycomb restart" @@ -650,6 +654,26 @@ class HoneycombSetup(object): logger.info("ODL client service stopped.") + @staticmethod + def set_static_arp(node, ip_address, mac_address): + """Configure a static ARP entry using arp. + + :param node: Node in topology. + :param ip_address: IP address for the entry. + :param mac_address: MAC adddress for the entry. + :type node: dict + :type ip_address: str + :type mac_address: str + :raises RuntimeError: If the operation fails. + """ + + ssh = SSH() + ssh.connect(node) + ret_code, _, _ = ssh.exec_command_sudo("arp -s {0} {1}".format( + ip_address, mac_address)) + + if ret_code != 0: + raise RuntimeError("Failed to configure static ARP adddress.") class HoneycombStartupConfig(object): |