|
| 1 | +"""Fixtures for circular config workflow tests.""" |
| 2 | + |
| 3 | +from pathlib import Path |
| 4 | + |
| 5 | +import pytest |
| 6 | + |
| 7 | + |
| 8 | +def _fixture_file_read(filename: str) -> str: |
| 9 | + """Read a fixture file from the fixtures directory.""" |
| 10 | + return str( |
| 11 | + Path(__file__) |
| 12 | + .resolve() |
| 13 | + .parent.joinpath("fixtures") |
| 14 | + .joinpath(filename) |
| 15 | + .read_text(encoding="utf8"), |
| 16 | + ) |
| 17 | + |
| 18 | + |
| 19 | +# Cisco IOS fixtures |
| 20 | +@pytest.fixture(scope="module") |
| 21 | +def ios_running_config() -> str: |
| 22 | + """Load IOS running config fixture.""" |
| 23 | + return _fixture_file_read("ios_running.conf") |
| 24 | + |
| 25 | + |
| 26 | +@pytest.fixture(scope="module") |
| 27 | +def ios_generated_config() -> str: |
| 28 | + """Load IOS generated config fixture.""" |
| 29 | + return _fixture_file_read("ios_generated.conf") |
| 30 | + |
| 31 | + |
| 32 | +@pytest.fixture(scope="module") |
| 33 | +def ios_remediation_config() -> str: |
| 34 | + """Load IOS remediation config fixture.""" |
| 35 | + return _fixture_file_read("ios_remediation.conf") |
| 36 | + |
| 37 | + |
| 38 | +@pytest.fixture(scope="module") |
| 39 | +def ios_rollback_config() -> str: |
| 40 | + """Load IOS rollback config fixture.""" |
| 41 | + return _fixture_file_read("ios_rollback.conf") |
| 42 | + |
| 43 | + |
| 44 | +# Arista EOS fixtures |
| 45 | +@pytest.fixture(scope="module") |
| 46 | +def eos_running_config() -> str: |
| 47 | + """Load EOS running config fixture.""" |
| 48 | + return _fixture_file_read("eos_running.conf") |
| 49 | + |
| 50 | + |
| 51 | +@pytest.fixture(scope="module") |
| 52 | +def eos_generated_config() -> str: |
| 53 | + """Load EOS generated config fixture.""" |
| 54 | + return _fixture_file_read("eos_generated.conf") |
| 55 | + |
| 56 | + |
| 57 | +@pytest.fixture(scope="module") |
| 58 | +def eos_remediation_config() -> str: |
| 59 | + """Load EOS remediation config fixture.""" |
| 60 | + return _fixture_file_read("eos_remediation.conf") |
| 61 | + |
| 62 | + |
| 63 | +@pytest.fixture(scope="module") |
| 64 | +def eos_rollback_config() -> str: |
| 65 | + """Load EOS rollback config fixture.""" |
| 66 | + return _fixture_file_read("eos_rollback.conf") |
| 67 | + |
| 68 | + |
| 69 | +# Cisco NXOS fixtures |
| 70 | +@pytest.fixture(scope="module") |
| 71 | +def nxos_running_config() -> str: |
| 72 | + """Load NXOS running config fixture.""" |
| 73 | + return _fixture_file_read("nxos_running.conf") |
| 74 | + |
| 75 | + |
| 76 | +@pytest.fixture(scope="module") |
| 77 | +def nxos_generated_config() -> str: |
| 78 | + """Load NXOS generated config fixture.""" |
| 79 | + return _fixture_file_read("nxos_generated.conf") |
| 80 | + |
| 81 | + |
| 82 | +@pytest.fixture(scope="module") |
| 83 | +def nxos_remediation_config() -> str: |
| 84 | + """Load NXOS remediation config fixture.""" |
| 85 | + return _fixture_file_read("nxos_remediation.conf") |
| 86 | + |
| 87 | + |
| 88 | +@pytest.fixture(scope="module") |
| 89 | +def nxos_rollback_config() -> str: |
| 90 | + """Load NXOS rollback config fixture.""" |
| 91 | + return _fixture_file_read("nxos_rollback.conf") |
| 92 | + |
| 93 | + |
| 94 | +# Cisco IOS-XR fixtures |
| 95 | +@pytest.fixture(scope="module") |
| 96 | +def iosxr_running_config() -> str: |
| 97 | + """Load IOS-XR running config fixture.""" |
| 98 | + return _fixture_file_read("iosxr_running.conf") |
| 99 | + |
| 100 | + |
| 101 | +@pytest.fixture(scope="module") |
| 102 | +def iosxr_generated_config() -> str: |
| 103 | + """Load IOS-XR generated config fixture.""" |
| 104 | + return _fixture_file_read("iosxr_generated.conf") |
| 105 | + |
| 106 | + |
| 107 | +@pytest.fixture(scope="module") |
| 108 | +def iosxr_remediation_config() -> str: |
| 109 | + """Load IOS-XR remediation config fixture.""" |
| 110 | + return _fixture_file_read("iosxr_remediation.conf") |
| 111 | + |
| 112 | + |
| 113 | +@pytest.fixture(scope="module") |
| 114 | +def iosxr_rollback_config() -> str: |
| 115 | + """Load IOS-XR rollback config fixture.""" |
| 116 | + return _fixture_file_read("iosxr_rollback.conf") |
| 117 | + |
| 118 | + |
| 119 | +# Juniper JunOS fixtures |
| 120 | +@pytest.fixture(scope="module") |
| 121 | +def junos_running_config() -> str: |
| 122 | + """Load JunOS running config fixture.""" |
| 123 | + return _fixture_file_read("junos_running.conf") |
| 124 | + |
| 125 | + |
| 126 | +@pytest.fixture(scope="module") |
| 127 | +def junos_generated_config() -> str: |
| 128 | + """Load JunOS generated config fixture.""" |
| 129 | + return _fixture_file_read("junos_generated.conf") |
| 130 | + |
| 131 | + |
| 132 | +@pytest.fixture(scope="module") |
| 133 | +def junos_remediation_config() -> str: |
| 134 | + """Load JunOS remediation config fixture.""" |
| 135 | + return _fixture_file_read("junos_remediation.conf") |
| 136 | + |
| 137 | + |
| 138 | +@pytest.fixture(scope="module") |
| 139 | +def junos_rollback_config() -> str: |
| 140 | + """Load JunOS rollback config fixture.""" |
| 141 | + return _fixture_file_read("junos_rollback.conf") |
| 142 | + |
| 143 | + |
| 144 | +# VyOS fixtures |
| 145 | +@pytest.fixture(scope="module") |
| 146 | +def vyos_running_config() -> str: |
| 147 | + """Load VyOS running config fixture.""" |
| 148 | + return _fixture_file_read("vyos_running.conf") |
| 149 | + |
| 150 | + |
| 151 | +@pytest.fixture(scope="module") |
| 152 | +def vyos_generated_config() -> str: |
| 153 | + """Load VyOS generated config fixture.""" |
| 154 | + return _fixture_file_read("vyos_generated.conf") |
| 155 | + |
| 156 | + |
| 157 | +@pytest.fixture(scope="module") |
| 158 | +def vyos_remediation_config() -> str: |
| 159 | + """Load VyOS remediation config fixture.""" |
| 160 | + return _fixture_file_read("vyos_remediation.conf") |
| 161 | + |
| 162 | + |
| 163 | +@pytest.fixture(scope="module") |
| 164 | +def vyos_rollback_config() -> str: |
| 165 | + """Load VyOS rollback config fixture.""" |
| 166 | + return _fixture_file_read("vyos_rollback.conf") |
| 167 | + |
| 168 | + |
| 169 | +# Fortinet FortiOS fixtures |
| 170 | +@pytest.fixture(scope="module") |
| 171 | +def fortios_running_config() -> str: |
| 172 | + """Load FortiOS running config fixture.""" |
| 173 | + return _fixture_file_read("fortios_running.conf") |
| 174 | + |
| 175 | + |
| 176 | +@pytest.fixture(scope="module") |
| 177 | +def fortios_generated_config() -> str: |
| 178 | + """Load FortiOS generated config fixture.""" |
| 179 | + return _fixture_file_read("fortios_generated.conf") |
| 180 | + |
| 181 | + |
| 182 | +@pytest.fixture(scope="module") |
| 183 | +def fortios_remediation_config() -> str: |
| 184 | + """Load FortiOS remediation config fixture.""" |
| 185 | + return _fixture_file_read("fortios_remediation.conf") |
| 186 | + |
| 187 | + |
| 188 | +@pytest.fixture(scope="module") |
| 189 | +def fortios_rollback_config() -> str: |
| 190 | + """Load FortiOS rollback config fixture.""" |
| 191 | + return _fixture_file_read("fortios_rollback.conf") |
| 192 | + |
| 193 | + |
| 194 | +# HP Comware5 fixtures |
| 195 | +@pytest.fixture(scope="module") |
| 196 | +def comware5_running_config() -> str: |
| 197 | + """Load HP Comware5 running config fixture.""" |
| 198 | + return _fixture_file_read("comware5_running.conf") |
| 199 | + |
| 200 | + |
| 201 | +@pytest.fixture(scope="module") |
| 202 | +def comware5_generated_config() -> str: |
| 203 | + """Load HP Comware5 generated config fixture.""" |
| 204 | + return _fixture_file_read("comware5_generated.conf") |
| 205 | + |
| 206 | + |
| 207 | +@pytest.fixture(scope="module") |
| 208 | +def comware5_remediation_config() -> str: |
| 209 | + """Load HP Comware5 remediation config fixture.""" |
| 210 | + return _fixture_file_read("comware5_remediation.conf") |
| 211 | + |
| 212 | + |
| 213 | +@pytest.fixture(scope="module") |
| 214 | +def comware5_rollback_config() -> str: |
| 215 | + """Load HP Comware5 rollback config fixture.""" |
| 216 | + return _fixture_file_read("comware5_rollback.conf") |
| 217 | + |
| 218 | + |
| 219 | +# HP Procurve fixtures |
| 220 | +@pytest.fixture(scope="module") |
| 221 | +def procurve_running_config() -> str: |
| 222 | + """Load HP Procurve running config fixture.""" |
| 223 | + return _fixture_file_read("procurve_running.conf") |
| 224 | + |
| 225 | + |
| 226 | +@pytest.fixture(scope="module") |
| 227 | +def procurve_generated_config() -> str: |
| 228 | + """Load HP Procurve generated config fixture.""" |
| 229 | + return _fixture_file_read("procurve_generated.conf") |
| 230 | + |
| 231 | + |
| 232 | +@pytest.fixture(scope="module") |
| 233 | +def procurve_remediation_config() -> str: |
| 234 | + """Load HP Procurve remediation config fixture.""" |
| 235 | + return _fixture_file_read("procurve_remediation.conf") |
| 236 | + |
| 237 | + |
| 238 | +@pytest.fixture(scope="module") |
| 239 | +def procurve_rollback_config() -> str: |
| 240 | + """Load HP Procurve rollback config fixture.""" |
| 241 | + return _fixture_file_read("procurve_rollback.conf") |
0 commit comments