:type nodes: list
:raises HoneycombError: If persisted configuration could not be removed.
"""
- cmd = "rm {0}/etc/opendaylight/honeycomb/*".format(
- Const.REMOTE_HC_DIR)
+ cmd = "rm -rf {}/*".format(Const.REMOTE_HC_PERSIST)
for node in nodes:
if node['type'] == NodeType.DUT:
ssh = SSH()
@staticmethod
def modify_persistence_files(node, find, replace):
- """Searches contents of persistence file config.json for the provided
+ """Searches contents of persistence file data.json for the provided
string, and replaces all occurrences with another string.
:param node: Honeycomb node.
"""
argument = "\"s/{0}/{1}/g\"".format(find, replace)
- path = "{0}/etc/opendaylight/honeycomb/config.json".format(
- Const.REMOTE_HC_DIR)
+ path = "{0}/config/data.json".format(Const.REMOTE_HC_PERSIST)
command = "sed -i {0} {1}".format(argument, path)
ssh = SSH()
if ret_code != 0:
raise HoneycombError("Failed to modify persistence file on node"
" {0}, {1}".format(node, stderr))
+
+ @staticmethod
+ def log_persisted_configuration(node):
+ """Read contents of Honeycomb persistence files and print them to log.
+
+ :param node: Honeycomb node.
+ :type node: dict
+ """
+
+ commands = [
+ "cat {0}/config/data.json".format(Const.REMOTE_HC_PERSIST),
+ "cat {0}/context/data.json".format(Const.REMOTE_HC_PERSIST),
+ ]
+
+ ssh = SSH()
+ ssh.connect(node)
+ for command in commands:
+ (_, stdout, _) = ssh.exec_command_sudo(command)
+ logger.info(stdout)