Debian Codegraph @

ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_sds_api.py

raw symbols SCIP
1 # Copyright: (c) 2024, Dell Technologies
2
3 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4
5 """
6 Mock Api response for Unit tests of SDS module on Dell Technologies (Dell) PowerFlex
7 """
8
9 from __future__ import (absolute_import, division, print_function)
10
11 __metaclass__ = type
12
13
14 class MockSDSApi:
15 SDS_COMMON_ARGS = {
16 "hostname": "**.***.**.***",
17 "sds_name": "test_node0",
18 "sds_id": None,
19 "sds_new_name": None,
20 "sds_ip_list": None,
21 "sds_ip_state": None,
22 "rfcache_enabled": None,
23 "rmcache_enabled": None,
24 "rmcache_size": None,
25 "performance_profile": None,
26 "protection_domain_name": None,
27 "protection_domain_id": None,
28 "fault_set_name": None,
29 "fault_set_id": None,
30 "fault_set_new_name": None,
31 "state": None
32 }
33
34 SDS_GET_LIST = [
35 {
36 "authenticationError": "None",
37 "certificateInfo": None,
38 "configuredDrlMode": "Volatile",
39 "drlMode": "Volatile",
40 "faultSetId": "test_id_1",
41 "fglMetadataCacheSize": 0,
42 "fglMetadataCacheState": "Disabled",
43 "fglNumConcurrentWrites": 1000,
44 "id": "8f3bb0cc00000002",
45 "ipList": [
46 {
47 "ip": "10.47.xxx.xxx",
48 "role": "all"
49 },
50 {
51 "ip": "10.46.xxx.xxx",
52 "role": "sdcOnly"
53 }
54 ],
55 "lastUpgradeTime": 0,
56 "links": [],
57 "maintenanceState": "NoMaintenance",
58 "maintenanceType": "NoMaintenance",
59 "mdmConnectionState": "Connected",
60 "membershipState": "Joined",
61 "name": "test_node0",
62 "numOfIoBuffers": None,
63 "numRestarts": 2,
64 "onVmWare": True,
65 "perfProfile": "HighPerformance",
66 "port": 7072,
67 "protectionDomainId": "9300c1f900000000",
68 "protectionDomainName": "test_domain",
69 "raidControllers": None,
70 "rfcacheEnabled": True,
71 "rfcacheErrorApiVersionMismatch": False,
72 "rfcacheErrorDeviceDoesNotExist": False,
73 "rfcacheErrorInconsistentCacheConfiguration": False,
74 "rfcacheErrorInconsistentSourceConfiguration": False,
75 "rfcacheErrorInvalidDriverPath": False,
76 "rfcacheErrorLowResources": False,
77 "rmcacheEnabled": True,
78 "rmcacheFrozen": False,
79 "rmcacheMemoryAllocationState": "AllocationPending",
80 "rmcacheSizeInKb": 131072,
81 "rmcacheSizeInMb": 128,
82 "sdsConfigurationFailure": None,
83 "sdsDecoupled": None,
84 "sdsReceiveBufferAllocationFailures": None,
85 "sdsState": "Normal",
86 "softwareVersionInfo": "R3_6.0.0"
87 }
88 ]
89
90 PROTECTION_DOMAIN = {
91 "protectiondomain": [
92 {
93 "id": "7bd6457000000000",
94 "name": "test_domain",
95 "protectionDomainState": "Active",
96 "overallIoNetworkThrottlingInKbps": 20480,
97 "rebalanceNetworkThrottlingInKbps": 10240,
98 "rebuildNetworkThrottlingInKbps": 10240,
99 "vtreeMigrationNetworkThrottlingInKbps": 10240,
100 "rfcacheEnabled": "false",
101 "rfcacheMaxIoSizeKb": 128,
102 "rfcacheOpertionalMode": "None",
103 "rfcachePageSizeKb": 64,
104 "storagePools": [
105 {
106 "id": "8d1cba1700000000",
107 "name": "pool1"
108 }
109 ]
110 }
111 ]
112 }
113
114 FAULT_SET_GET_LIST = [
115 {
116 "protectionDomainId": "test_domain",
117 "name": "fault_set_name",
118 "id": "fault_set_id",
119 "links": []
120 }
121 ]
122
123 RESPONSE_EXEC_DICT = {
124 "delete_sds_exception": "Delete SDS '8f3bb0cc00000002' operation failed with error",
125 "rename_sds_exception": "Failed to update the SDS",
126 "create_sds_exception": "Create SDS test_node0 operation failed with error",
127 "get_sds_exception": "Failed to get the SDS",
128 "rmcache_size_exception": "RM cache size can be set only when RM cache is enabled",
129 "create_sds_wo_sds_name": "Please provide valid sds_name value for creation of SDS.",
130 "create_sds_wo_pd": "Protection Domain is a mandatory parameter",
131 "create_sds_wo_sds_ip_list": "Please provide valid sds_ip_list values for " +
132 "creation of SDS.",
133 "create_sds_incorrect_sds_ip_state": "Incorrect IP state given for creation of SDS.",
134 "create_sds_sds_id": "Creation of SDS is allowed using sds_name " +
135 "only, sds_id given.",
136 "create_sds_sds_new_name": "sds_new_name parameter is not supported " +
137 "during creation of a SDS. Try renaming the " +
138 "SDS after the creation.",
139 "rename_sds_empty_exception": "Provide valid value for name for the creation/modification of the SDS.",
140 "add_ip_exception": "Add IP to SDS '8f3bb0cc00000002' operation failed with error ",
141 "remove_ip_exception": "Remove IP from SDS '8f3bb0cc00000002' operation failed with error ",
142 "set_ip_role_exception": "Update role of IP for SDS '8f3bb0cc00000002' operation failed"
143 }
144
145 @staticmethod
146 def get_sds_exception_response(response_type):
147 return MockSDSApi.RESPONSE_EXEC_DICT.get(response_type, "")