X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FVatHistory.py;h=e273746f9b2d6b76b56e09b924316065902c1d11;hp=caa3de50f2df42bc4c54a57968300ea459699ab0;hb=c7eb2002bcd007520309feb3e11a26ff847a4e05;hpb=44dc1d4781470b722c5f7d5adb197ace96b96db3 diff --git a/resources/libraries/python/VatHistory.py b/resources/libraries/python/VatHistory.py index caa3de50f2..e273746f9b 100644 --- a/resources/libraries/python/VatHistory.py +++ b/resources/libraries/python/VatHistory.py @@ -17,17 +17,26 @@ from robot.api import logger from resources.libraries.python.topology import NodeType, DICT__nodes -__all__ = ["DICT__duts_vat_history", "VatHistory"] +__all__ = ["DICT__DUTS_VAT_HISTORY", "VatHistory"] def setup_vat_history(nodes): + """Setup VAT history for DUT nodes. + + :param nodes: DUT nodes to setup VAT history for. + :type nodes: dict + """ duts_vat_history = {} - for node in nodes.values(): - if node['type'] == NodeType.DUT: - duts_vat_history[node['host']] = [] - return duts_vat_history + try: + for node in nodes.values(): + if node['type'] == NodeType.DUT: + duts_vat_history[node['host']] = [] + return duts_vat_history + except AttributeError: + # Necessary for the generation of source code documentation. + pass -DICT__duts_vat_history = setup_vat_history(DICT__nodes) +DICT__DUTS_VAT_HISTORY = setup_vat_history(DICT__nodes) class VatHistory(object): @@ -41,7 +50,7 @@ class VatHistory(object): :type node: dict """ if node['type'] == NodeType.DUT: - DICT__duts_vat_history[node['host']] = [] + DICT__DUTS_VAT_HISTORY[node['host']] = [] @staticmethod def reset_vat_history_on_all_duts(nodes): @@ -63,9 +72,9 @@ class VatHistory(object): """ if node['type'] == NodeType.DUT: sequence = "\nno VAT command executed"\ - if len(DICT__duts_vat_history[node['host']]) == 0\ + if len(DICT__DUTS_VAT_HISTORY[node['host']]) == 0\ else "".join("\n{}".format(cmd) - for cmd in DICT__duts_vat_history[node['host']]) + for cmd in DICT__DUTS_VAT_HISTORY[node['host']]) logger.trace("{0} VAT command history:{1}\n". format(node['host'], sequence)) @@ -90,4 +99,4 @@ class VatHistory(object): :type cmd: str """ if node['type'] == NodeType.DUT: - DICT__duts_vat_history[node['host']].append(cmd) + DICT__DUTS_VAT_HISTORY[node['host']].append(cmd)