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):
: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):
"""
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))
:type cmd: str
"""
if node['type'] == NodeType.DUT:
- DICT__duts_vat_history[node['host']].append(cmd)
+ DICT__DUTS_VAT_HISTORY[node['host']].append(cmd)