Skip to content

Data

software_mapping module-attribute

software_mapping = DataMapping(
    CloudVision={
        "ova": {"extension": ".ova", "prepend": "cvp"},
        "rpm": {
            "extension": "",
            "prepend": "cvp-rpm-installer",
        },
        "kvm": {"extension": "-kvm.tgz", "prepend": "cvp"},
        "upgrade": {
            "extension": ".tgz",
            "prepend": "cvp-upgrade",
        },
    },
    EOS={
        "64": {"extension": ".swi", "prepend": "EOS64"},
        "INT": {"extension": "-INT.swi", "prepend": "EOS"},
        "2GB-INT": {
            "extension": "-INT.swi",
            "prepend": "EOS-2GB",
        },
        "cEOS": {
            "extension": ".tar.xz",
            "prepend": "cEOS-lab",
        },
        "cEOS64": {
            "extension": ".tar.xz",
            "prepend": "cEOS64-lab",
        },
        "vEOS": {"extension": ".vmdk", "prepend": "vEOS"},
        "vEOS-lab": {
            "extension": ".vmdk",
            "prepend": "vEOS-lab",
        },
        "EOS-2GB": {
            "extension": ".swi",
            "prepend": "EOS-2GB",
        },
        "RN": {"extension": "-", "prepend": "RN"},
        "SOURCE": {
            "extension": "-source.tar",
            "prepend": "EOS",
        },
        "default": {"extension": ".swi", "prepend": "EOS"},
    },
)

data

This module defines data models and mappings for image types of CloudVision and EOS on Arista.com.

Classes:

Name Description
ImageInfo:

A Pydantic model representing image information for a specific image type.

DataMapping:

A Pydantic model representing data mapping for image types of CloudVision and EOS on Arista.com.

Functions:

Name Description
DataMapping.filename

Generates a filename based on the provided software, image type, and version.

Constants
  • RTYPE_FEATURE (ReleaseType): Represents a feature release type.
  • RTYPE_MAINTENANCE (ReleaseType): Represents a maintenance release type.
  • RTYPES (List[ReleaseType]): A list containing the feature and maintenance release types.
Variables
  • software_mapping (DataMapping): An instance of DataMapping containing the mappings for CloudVision and EOS image types.

DataMapping

Bases: BaseModel

Data mapping for image types of CloudVision and EOS on Arista.com.

Attributes:

Name Type Description
CloudVision Dict[str, ImageInfo]

Mapping of image types to their information for CloudVision.

EOS Dict[str, ImageInfo]

Mapping of image types to their information for EOS.

Methods:

Name Description
filename

Generates a filename based on the provided software, image type, and version.

filename

filename(
    software: AristaMapping, image_type: str, version: str
) -> str

Generates a filename based on the provided software, image type, and version.

Parameters:

Name Type Description Default
software AristaMapping

The name of the software for which the filename is being generated.

required
image_type str

The type of image for which the filename is being generated.

required
version str

The version of the software or image.

required

Returns:

Type Description
str

The generated filename.

Raises:

Type Description
ValueError

If the software does not have a corresponding mapping.

ValueError

If no configuration is found for the given image type and no default configuration is available.

Source code in eos_downloader/models/data.py
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
def filename(self, software: AristaMapping, image_type: str, version: str) -> str:
    """Generates a filename based on the provided software, image type, and version.

    Parameters
    ----------
    software : AristaMapping
        The name of the software for which the filename is being generated.
    image_type : str
        The type of image for which the filename is being generated.
    version : str
        The version of the software or image.

    Returns
    -------
    str
        The generated filename.

    Raises
    ------
    ValueError
        If the software does not have a corresponding mapping.
    ValueError
        If no configuration is found for the given image type and no default configuration is available.
    """

    if hasattr(self, software):
        soft_mapping = getattr(self, software)
        image_config = soft_mapping.get(image_type, None)
        if image_config is None:
            image_config = getattr(soft_mapping, "default", None)
            if image_config is None:
                raise ValueError(
                    f"No default configuration found for image type {image_type}"
                )
        if image_config is not None:
            return f"{image_config.prepend}-{version}{image_config.extension}"
        raise ValueError(f"No configuration found for image type {image_type}")
    raise ValueError(f"Incorrect value for software {software}")

ImageInfo

Bases: BaseModel

Image information for a specific image type.

Attributes:

Name Type Description
extension str

The file extension for the image type.

prepend str

The prefix to prepend to the filename.