+
+ @staticmethod
+ def load_docker_image_on_node(node, image_path):
+ """Load Docker container image from file on node.
+
+ :param node: DUT node.
+ :param image_path: Container image path.
+ :type node: dict
+ :type image_path: str
+ :raises RuntimeError: If loading image failed on node.
+ """
+ command = f"docker load -i {image_path}"
+ message = f"Failed to load Docker image on {node[u'host']}."
+ exec_cmd_no_error(
+ node, command, timeout=240, sudo=True, message=message
+ )
+
+ command = u"docker rmi $(sudo docker images -f 'dangling=true' -q)"
+ message = f"Failed to clean Docker images on {node[u'host']}."
+ try:
+ exec_cmd_no_error(
+ node, command, timeout=240, sudo=True, message=message
+ )
+ except RuntimeError:
+ pass
+
+ @staticmethod
+ def load_docker_image_on_all_duts(nodes, image_path):
+ """Load Docker container image from file on all DUTs.
+
+ :param nodes: Topology nodes.
+ :param image_path: Container image path.
+ :type nodes: dict
+ :type image_path: str
+ """
+ for node in nodes.values():
+ if node[u"type"] == NodeType.DUT:
+ KubernetesUtils.load_docker_image_on_node(node, image_path)