|
| 1 | +# Copyright (c) 2023-2024 Arista Networks, Inc. |
| 2 | +# Use of this source code is governed by the Apache License 2.0 |
| 3 | +# that can be found in the LICENSE file. |
| 4 | +"""Data for testing anta.tests.cvx.""" |
| 5 | + |
| 6 | +from __future__ import annotations |
| 7 | + |
| 8 | +from typing import Any |
| 9 | + |
| 10 | +from anta.tests.cvx import VerifyManagementCVX, VerifyMcsClientMounts |
| 11 | +from tests.units.anta_tests import test |
| 12 | + |
| 13 | +DATA: list[dict[str, Any]] = [ |
| 14 | + { |
| 15 | + "name": "success", |
| 16 | + "test": VerifyMcsClientMounts, |
| 17 | + "eos_data": [{"mountStates": [{"path": "mcs/v1/toSwitch/28-99-3a-8f-93-7b", "type": "Mcs::DeviceConfigV1", "state": "mountStateMountComplete"}]}], |
| 18 | + "inputs": None, |
| 19 | + "expected": {"result": "success"}, |
| 20 | + }, |
| 21 | + { |
| 22 | + "name": "success-haclient", |
| 23 | + "test": VerifyMcsClientMounts, |
| 24 | + "eos_data": [ |
| 25 | + { |
| 26 | + "mountStates": [ |
| 27 | + {"path": "mcs/v1/apiCfgRedState", "type": "Mcs::ApiConfigRedundancyState", "state": "mountStateMountComplete"}, |
| 28 | + {"path": "mcs/v1/toSwitch/00-1c-73-74-c0-8b", "type": "Mcs::DeviceConfigV1", "state": "mountStateMountComplete"}, |
| 29 | + ] |
| 30 | + }, |
| 31 | + ], |
| 32 | + "inputs": None, |
| 33 | + "expected": {"result": "success"}, |
| 34 | + }, |
| 35 | + { |
| 36 | + "name": "success-partial-non-mcs", |
| 37 | + "test": VerifyMcsClientMounts, |
| 38 | + "eos_data": [ |
| 39 | + { |
| 40 | + "mountStates": [ |
| 41 | + {"path": "blah/blah/blah", "type": "blah::blah", "state": "mountStatePreservedUnmounted"}, |
| 42 | + {"path": "mcs/v1/toSwitch/00-1c-73-74-c0-8b", "type": "Mcs::DeviceConfigV1", "state": "mountStateMountComplete"}, |
| 43 | + ] |
| 44 | + }, |
| 45 | + ], |
| 46 | + "inputs": None, |
| 47 | + "expected": {"result": "success"}, |
| 48 | + }, |
| 49 | + { |
| 50 | + "name": "failure-nomounts", |
| 51 | + "test": VerifyMcsClientMounts, |
| 52 | + "eos_data": [ |
| 53 | + {"mountStates": []}, |
| 54 | + ], |
| 55 | + "inputs": None, |
| 56 | + "expected": {"result": "failure", "messages": ["MCS Client mount states are not present"]}, |
| 57 | + }, |
| 58 | + { |
| 59 | + "name": "failure-mountStatePreservedUnmounted", |
| 60 | + "test": VerifyMcsClientMounts, |
| 61 | + "eos_data": [{"mountStates": [{"path": "mcs/v1/toSwitch/28-99-3a-8f-93-7b", "type": "Mcs::DeviceConfigV1", "state": "mountStatePreservedUnmounted"}]}], |
| 62 | + "inputs": None, |
| 63 | + "expected": {"result": "failure", "messages": ["MCS Client mount states are not valid: mountStatePreservedUnmounted"]}, |
| 64 | + }, |
| 65 | + { |
| 66 | + "name": "failure-partial-haclient", |
| 67 | + "test": VerifyMcsClientMounts, |
| 68 | + "eos_data": [ |
| 69 | + { |
| 70 | + "mountStates": [ |
| 71 | + {"path": "mcs/v1/apiCfgRedState", "type": "Mcs::ApiConfigRedundancyState", "state": "mountStateMountComplete"}, |
| 72 | + {"path": "mcs/v1/toSwitch/00-1c-73-74-c0-8b", "type": "Mcs::DeviceConfigV1", "state": "mountStatePreservedUnmounted"}, |
| 73 | + ] |
| 74 | + }, |
| 75 | + ], |
| 76 | + "inputs": None, |
| 77 | + "expected": {"result": "failure", "messages": ["MCS Client mount states are not valid: mountStatePreservedUnmounted"]}, |
| 78 | + }, |
| 79 | + { |
| 80 | + "name": "failure-full-haclient", |
| 81 | + "test": VerifyMcsClientMounts, |
| 82 | + "eos_data": [ |
| 83 | + { |
| 84 | + "mountStates": [ |
| 85 | + {"path": "blah/blah/blah", "type": "blah::blahState", "state": "mountStatePreservedUnmounted"}, |
| 86 | + {"path": "mcs/v1/toSwitch/00-1c-73-74-c0-8b", "type": "Mcs::DeviceConfigV1", "state": "mountStatePreservedUnmounted"}, |
| 87 | + ] |
| 88 | + }, |
| 89 | + ], |
| 90 | + "inputs": None, |
| 91 | + "expected": {"result": "failure", "messages": ["MCS Client mount states are not valid: mountStatePreservedUnmounted"]}, |
| 92 | + }, |
| 93 | + { |
| 94 | + "name": "failure-non-mcs-client", |
| 95 | + "test": VerifyMcsClientMounts, |
| 96 | + "eos_data": [ |
| 97 | + {"mountStates": [{"path": "blah/blah/blah", "type": "blah::blahState", "state": "mountStatePreservedUnmounted"}]}, |
| 98 | + ], |
| 99 | + "inputs": None, |
| 100 | + "expected": {"result": "failure", "messages": ["MCS Client mount states are not present"]}, |
| 101 | + }, |
| 102 | + { |
| 103 | + "name": "failure-partial-mcs-client", |
| 104 | + "test": VerifyMcsClientMounts, |
| 105 | + "eos_data": [ |
| 106 | + { |
| 107 | + "mountStates": [ |
| 108 | + {"path": "blah/blah/blah", "type": "blah::blahState", "state": "mountStatePreservedUnmounted"}, |
| 109 | + {"path": "blah/blah/blah", "type": "Mcs::DeviceConfigV1", "state": "mountStatePreservedUnmounted"}, |
| 110 | + ] |
| 111 | + }, |
| 112 | + ], |
| 113 | + "inputs": None, |
| 114 | + "expected": {"result": "failure", "messages": ["MCS Client mount states are not valid: mountStatePreservedUnmounted"]}, |
| 115 | + }, |
| 116 | + { |
| 117 | + "name": "success-enabled", |
| 118 | + "test": VerifyManagementCVX, |
| 119 | + "eos_data": [ |
| 120 | + { |
| 121 | + "clusterStatus": { |
| 122 | + "enabled": True, |
| 123 | + } |
| 124 | + } |
| 125 | + ], |
| 126 | + "inputs": {"enabled": True}, |
| 127 | + "expected": {"result": "success"}, |
| 128 | + }, |
| 129 | + { |
| 130 | + "name": "success-disabled", |
| 131 | + "test": VerifyManagementCVX, |
| 132 | + "eos_data": [ |
| 133 | + { |
| 134 | + "clusterStatus": { |
| 135 | + "enabled": False, |
| 136 | + } |
| 137 | + } |
| 138 | + ], |
| 139 | + "inputs": {"enabled": False}, |
| 140 | + "expected": {"result": "success"}, |
| 141 | + }, |
| 142 | + { |
| 143 | + "name": "failure", |
| 144 | + "test": VerifyManagementCVX, |
| 145 | + "eos_data": [{"clusterStatus": {}}], |
| 146 | + "inputs": {"enabled": False}, |
| 147 | + "expected": {"result": "failure", "messages": ["Management CVX status is not valid: None"]}, |
| 148 | + }, |
| 149 | +] |
0 commit comments