Debian Codegraph @

ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_sdt_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 SDT module on Dell Technologies PowerFlex
7 """
8
9 from __future__ import absolute_import, division, print_function
10
11 __metaclass__ = type
12
13
14 class MockSDTApi:
15 SDT_COMMON_ARGS = {
16 "hostname": "**.***.**.***",
17 "sdt_name": None,
18 "sdt_new_name": None,
19 "sdt_ip_list": None,
20 "storage_port": None,
21 "nvme_port": None,
22 "discovery_port": None,
23 "maintenance_mode": None,
24 "protection_domain_name": None,
25 "protection_domain_id": None,
26 "state": None,
27 }
28
29 SDT_GET_LIST = [
30 {
31 "ipList": [
32 {"role": "StorageAndHost", "ip": "10.47.xxx.xxx"},
33 {"role": "StorageAndHost", "ip": "10.46.xxx.xxx"},
34 ],
35 "sdtState": "Normal",
36 "name": "sdt1",
37 "systemId": "804696a4dbe1d90f",
38 "storagePort": 12200,
39 "nvmePort": 4420,
40 "discoveryPort": 8009,
41 "protectionDomainId": "b4787fa100000000",
42 "certificateInfo": None,
43 "mdmConnectionState": "Connected",
44 "membershipState": "Joined",
45 "faultSetId": None,
46 "softwareVersionInfo": "R4_5.2100.0",
47 "maintenanceState": "NoMaintenance",
48 "persistentDiscoveryControllersNum": 0,
49 "authenticationError": "None",
50 "id": "917d28ed00000000",
51 "links": [],
52 }
53 ]
54
55 PROTECTION_DOMAIN = {
56 "protectiondomain": [
57 {
58 "id": "7bd6457000000000",
59 "name": "test_domain",
60 "protectionDomainState": "Active",
61 "overallIoNetworkThrottlingInKbps": 20480,
62 "rebalanceNetworkThrottlingInKbps": 10240,
63 "rebuildNetworkThrottlingInKbps": 10240,
64 "vtreeMigrationNetworkThrottlingInKbps": 10240,
65 "rfcacheEnabled": "false",
66 "rfcacheMaxIoSizeKb": 128,
67 "rfcacheOpertionalMode": "None",
68 "rfcachePageSizeKb": 64,
69 "storagePools": [{"id": "8d1cba1700000000", "name": "pool1"}],
70 }
71 ]
72 }
73
74 RESPONSE_EXEC_DICT = {
75 "delete_sdt_exception": "Delete SDT 'sdt1' operation failed with error",
76 "rename_sdt_exception": "Failed to update the SDT",
77 "create_sdt_exception": "Create SDT sdt2 operation failed with error",
78 "get_sdt_exception": "Failed to get the SDT",
79 "create_sdt_without_sdt_name": "Provide valid value for name for the creation or modification of the SDT.",
80 "create_sdt_without_pd": "Protection Domain is a mandatory parameter",
81 "create_sdt_without_sdt_ip_list": "Provide valid values for sdt_ip_list as 'ip' and 'role' for Create or Modify operations",
82 "rename_sdt_empty_exception": "Provide valid value for name for the creation or modification of the SDT.",
83 "add_ip_list_exception": "Add IP to SDT 'sdt1' operation failed with error",
84 "remove_ip_list_exception": "Remove IP from SDT 'sdt1' operation failed with error",
85 "set_ip_role_exception": "Update role of IP for SDT 'sdt1' operation failed",
86 }
87
88 @staticmethod
89 def get_sdt_exception_response(response_type):
90 return MockSDTApi.RESPONSE_EXEC_DICT.get(response_type, "")