summaryrefslogtreecommitdiffstats
path: root/tests/lib/dataset.py
blob: 34175e938e1d79e82d2a94871721da2c58a1b41f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
111
112
113
114
115
116
117
#!/usr/bin/python
# coding: utf-8 -*-
# pylint: disable=logger-format-interpolation
# pylint: disable=dangerous-default-value
# flake8: noqa: W503
# flake8: noqa: W1202

from __future__ import absolute_import, division, print_function

import os

import eos_downloader
from eos_downloader.data import DATA_MAPPING
from eos_downloader.eos import EOSDownloader

# --------------------------------------------------------------- #
# MOOCK data to use for testing
# --------------------------------------------------------------- #

# Get Auth token
# eos_token = os.getenv('ARISTA_TOKEN')
eos_token = os.getenv("ARISTA_TOKEN", "invalid_token")
eos_token_invalid = "invalid_token"

eos_dataset_valid = [
    {
        "image": "EOS",
        "version": "4.26.3M",
        "software": "EOS",
        "filename": "EOS-4.26.3M.swi",
        "expected_hash": "sha512sum",
        "remote_path": "/support/download/EOS-USA/Active Releases/4.26/EOS-4.26.3M/EOS-4.26.3M.swi",
        "compute_checksum": True,
    },
    {
        "image": "EOS",
        "version": "4.25.6M",
        "software": "EOS",
        "filename": "EOS-4.25.6M.swi",
        "expected_hash": "md5sum",
        "remote_path": "/support/download/EOS-USA/Active Releases/4.25/EOS-4.25.6M/EOS-4.25.6M.swi",
        "compute_checksum": True,
    },
    {
        "image": "vEOS-lab",
        "version": "4.25.6M",
        "software": "EOS",
        "filename": "vEOS-lab-4.25.6M.vmdk",
        "expected_hash": "md5sum",
        "remote_path": "/support/download/EOS-USA/Active Releases/4.25/EOS-4.25.6M/vEOS-lab/vEOS-lab-4.25.6M.vmdk",
        "compute_checksum": False,
    },
]


eos_dataset_invalid = [
    {
        "image": "default",
        "version": "4.26.3M",
        "software": "EOS",
        "filename": "EOS-4.26.3M.swi",
        "expected_hash": "sha512sum",
        "remote_path": "/support/download/EOS-USA/Active Releases/4.26/EOS-4.26.3M/EOS-4.26.3M.swi",
        "compute_checksum": True,
    }
]

eos_version = [
    {
        "version": "EOS-4.23.1F",
        "is_valid": True,
        "major": 4,
        "minor": 23,
        "patch": 1,
        "rtype": "F",
    },
    {
        "version": "EOS-4.23.0",
        "is_valid": True,
        "major": 4,
        "minor": 23,
        "patch": 0,
        "rtype": None,
    },
    {
        "version": "EOS-4.23",
        "is_valid": True,
        "major": 4,
        "minor": 23,
        "patch": 0,
        "rtype": None,
    },
    {
        "version": "EOS-4.23.1M",
        "is_valid": True,
        "major": 4,
        "minor": 23,
        "patch": 1,
        "rtype": "M",
    },
    {
        "version": "EOS-4.23.1.F",
        "is_valid": True,
        "major": 4,
        "minor": 23,
        "patch": 1,
        "rtype": "F",
    },
    {
        "version": "EOS-5.23.1F",
        "is_valid": False,
        "major": 4,
        "minor": 23,
        "patch": 1,
        "rtype": "F",
    },
]