def check_image_existence (self, img_name): """ check_image_existence(self, img_name) -> boolean Parameters ---------- img_name : str a string represents the image name. Check if the image file defined in the platform_config already loaded into the platform. """ search_drives = ['bootflash', 'harddisk', self.running_image['drive']] for search_drive in search_drives: command = "dir {drive}: | include {image}".format(drive = search_drive, image = img_name) response = self.cmd_link.run_single_command(command, timeout = 10) if CShowParser.parse_image_existence(response, img_name): self.needed_image_path = '%s:/%s' % (search_drive, img_name) print('Found image in platform:', self.needed_image_path) return True return False