Example #1
0
def _is_valid_cisco_connection(cisco_username, cisco_password, proxy_str):
    '''
    This internal method validates connection to the cisco for firmware update
    TODO: Need to verify connection to cisco from central
    '''
    image_list = []
    image_list = get_ucsc_cco_image_list(username=cisco_username,
                                         password=cisco_password,
                                         proxy=proxy_str)

    if image_list == []:
        UcscWarning("Connection to cisco.com failed")
        return False
    return True
Example #2
0
def get_cco_firmware_image(image_name, username, password, download_dir,
                           mdf_id_list=(284308174,), proxy=None,
                           progress=Progress()):
    '''
    Downloads the firmware from CCO given the image name
    Args:
        image_name (str): Name of the image to be downloaded from cco
        username (str): username to connect to cco image server
        password (str): password to connect to cco image server
        mdf_id_list (list): list of mdf id
                            284308174 - ucs central firmware images(default)
                            283612660 - ucs infra bundle and catalog
                            283853163 - b-series ucs blade servers
                            283862063 - c-series ucs rack servers
        proxy (str): proxy used for connection
    Example:
        get_cco_firmware_image(image_name='ucs-central-bundle.1.5.1a.bin',
                          username='guest', password='password',
                          download_dir='/Users/guest/Downloads/')
    '''

    images = get_ucsc_cco_image_list(username=username,
                                     password=password,
                                     mdf_id_list=mdf_id_list,
                                     proxy=proxy)

    image_dict = {}
    for image in images:
        image_dict[image.image_name] = image

    if image_name not in image_dict:
        raise UcscOperationError("Get CCO image", "Image not available")

    # download image
    image = image_dict[image_name]
    get_ucsc_cco_image(
        image,
        file_dir=download_dir,
        proxy=proxy,
        progress=progress)