Debian Codegraph @

ansible_collections/netapp_eseries/santricity/tests/unit/modules/test_na_santricity_facts.py

raw symbols SCIP
1 # (c) 2020, NetApp, Inc
2 # BSD-3 Clause (see COPYING or https://opensource.org/licenses/BSD-3-Clause)
3 from __future__ import absolute_import, division, print_function
4 __metaclass__ = type
5
6 import unittest
7 from contextlib import contextmanager
8 from ansible.module_utils.testing import patch_module_args
9 from ansible_collections.netapp_eseries.santricity.plugins.modules.na_santricity_facts import Facts
10 from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
11 AnsibleFailJson, ModuleTestCase
12 )
13 from ansible_collections.community.internal_test_tools.tests.unit.compat import mock
14
15
16 class FactsTest(ModuleTestCase):
17 REQUIRED_PARAMS = {
18 'api_username': 'rw',
19 'api_password': 'password',
20 'api_url': 'http://localhost',
21 'ssid': '1'
22 }
23 REQUEST_FUNC = 'ansible_collections.netapp_eseries.santricity.plugins.modules.na_santricity_facts.Facts.request'
24 GET_CONTROLLERS_FUNC = 'ansible_collections.netapp_eseries.santricity.plugins.modules.na_santricity_facts.Facts.get_controllers'
25 WORKLOAD_RESPONSE = [{"id": "4200000001000000000000000000000000000000", "name": "beegfs_metadata",
26 "workloadAttributes": [{"key": "profileId", "value": "ansible_workload_1"}]},
27 {"id": "4200000002000000000000000000000000000000", "name": "other_workload_1",
28 "workloadAttributes": [{"key": "profileId", "value": "Other_1"}]}]
29 GRAPH_RESPONSE = {
30 "sa": {"saData": {"storageArrayLabel": "ictm0718s01c1", "saId": {"worldWideName": "600A098000A4B28D000000005CF10481"}, "fwVersion": "08.42.30.05",
31 "chassisSerialNumber": "021633035190"},
32 "featureParameters": {"cacheBlockSizes": [4096, 8192, 16384, 32768],
33 "supportedSegSizes": [32768, 65536, 131072, 262144, 524288, 495616, 655360, 1982464]},
34 "capabilities": ["autoCodeSync", "autoLunTransfer", "subLunsAllowed", "stagedDownload", "mixedDriveTypes", "bundleMigration", "raid6",
35 "performanceTier", "secureVolume", "protectionInformation", "ssdSupport", "driveSlotLimit", "flashReadCache",
36 "storagePoolsType2", "totalNumberOfArvmMirrorsPerArray", "totalNumberOfPitsPerArray", "totalNumberOfThinVolumesPerArray"],
37 "premiumFeatures": [],
38 "hostSpecificVals": [{"hostType": "FactoryDefault", "index": 0}, {"hostType": "W2KNETNCL", "index": 1}, {"hostPortType": "W2KNETCL", "index": 8},
39 {"hostType": "LnxTPGSALUA_SF", "index": 27}, {"hostType": "LnxDHALUA", "index": 28}]}, "controller": [
40 {"active": True, "quiesced": False, "status": "optimal", "controllerRef": "070000000000000000000001",
41 "physicalLocation": {"trayRef": "0E00000000000000000000000000000000000000", "slot": 1,
42 "locationParent": {"refType": "generic", "controllerRef": None, "symbolRef": "0000000000000000000000000000000000000000",
43 "typedReference": None}, "locationPosition": 1, "label": "A"}, "manufacturer": "NETAPP ",
44 "manufacturerDate": "1474675200", "appVersion": "08.42.30.05", "bootVersion": "08.42.30.05", "productID": "INF-01-00 ",
45 "productRevLevel": "0842", "serialNumber": "021619039162 ", "boardID": "2806", "cacheMemorySize": 3328, "processorMemorySize": 1278,
46 "hostInterfaces": [{"interfaceType": "iscsi", "fibre": None, "ib": None,
47 "iscsi": {"channel": 1, "channelPortRef": "1F00010001010000000000000000000000000000", "tcpListenPort": 3260,
48 "ipv4Enabled": True, "ipv4Data": {"ipv4Address": "0.0.0.0", "ipv4AddressConfigMethod": "configStatic",
49 "ipv4OutboundPacketPriority": {"isEnabled": False, "value": 1},
50 "ipv4VlanId": {"isEnabled": False, "value": 1},
51 "ipv4AddressData": {"configState": "configured", "ipv4Address": "10.10.11.110",
52 "ipv4SubnetMask": "255.255.255.0",
53 "ipv4GatewayAddress": "0.0.0.0"}},
54 "interfaceData": {"type": "ethernet", "ethernetData": {
55 "partData": {"vendorName": "QLogic Corporation", "partNumber": "83xx", "revisionNumber": "5.5.31.511",
56 "serialNumber": "00a098a4b28f"}, "macAddress": "00A098A4B293", "fullDuplex": True,
57 "maximumFramePayloadSize": 9000, "currentInterfaceSpeed": "speed10gig", "maximumInterfaceSpeed": "speed10gig",
58 "linkStatus": "up", "supportedInterfaceSpeeds": ["speed1gig", "speed10gig"], "autoconfigSupport": False,
59 "copperCableDiagnosticsSupport": False}, "infinibandData": None},
60 "interfaceRef": "2201020000000000000000000000000000000000", "ipv6Enabled": True,
61 "ipv6Data": {"ipv6LocalAddresses": [
62 {"address": "FE8000000000000002A098FFFEA4B293",
63 "addressState": {"addressType": "typeInterface", "interfaceAddressState": "configured",
64 "routerAddressState": "__UNDEFINED"}}], "ipv6RoutableAddresses": [
65 {"address": "00000000000000000000000000000000",
66 "addressState": {"addressType": "typeInterface", "interfaceAddressState": "unconfigured",
67 "routerAddressState": "__UNDEFINED"}},
68 {"address": "00000000000000000000000000000000",
69 "addressState": {"addressType": "typeInterface", "interfaceAddressState": "unconfigured",
70 "routerAddressState": "__UNDEFINED"}}],
71 "ipv6PortRouterAddress": {"address": "00000000000000000000000000000000",
72 "addressState": {"addressType": "typeRouter", "interfaceAddressState": "__UNDEFINED",
73 "routerAddressState": "unknown"}},
74 "ipv6AddressConfigMethod": "configStateless", "ipv6OutboundPacketPriority": {"isEnabled": False, "value": 1},
75 "ipv6VlanId": {"isEnabled": False, "value": 1}, "ipv6HopLimit": 64, "ipv6NdReachableTime": 30000,
76 "ipv6NdRetransmitTime": 1000, "ipv6NdStaleTimeout": 30000, "ipv6DuplicateAddressDetectionAttempts": 1},
77 "physicalLocation": {"trayRef": "0000000000000000000000000000000000000000", "slot": 0,
78 "locationParent": {"refType": "generic", "controllerRef": None,
79 "symbolRef": "0000000000000000000000000000000000000000",
80 "typedReference": None}, "locationPosition": 0, "label": ""},
81 "protectionInformationCapable": True, "isIPv6Capable": True, "oneWayMaxRate": "1230000000",
82 "bidirectionalMaxRate": "2120000000", "iqn": "iqn.1992-08.com.netapp:2806.600a098000a4b28d000000005cf10481",
83 "controllerId": "070000000000000000000001",
84 "addressId": "iqn.1992-08.com.netapp:2806.600a098000a4b28d000000005cf10481",
85 "niceAddressId": "iqn.1992-08.com.netapp:2806.600a098000a4b28d000000005cf10481",
86 "interfaceId": "2201020000000000000000000000000000000000", "id": "2201020000000000000000000000000000000000"},
87 "sas": None, "sata": None, "scsi": None}],
88 "driveInterfaces": [
89 {"interfaceType": "sas", "fibre": None, "ib": None, "iscsi": None,
90 "sas": {"channel": 1, "currentInterfaceSpeed": "speed12gig", "maximumInterfaceSpeed": "speed12gig", "part": "LSISAS3008",
91 "revision": 172688896, "isDegraded": False,
92 "iocPort": {
93 "parent": {"type": "controller", "controller": "070000000000000000000001", "drive": None, "expander": None, "hostBoardRef": None},
94 "attachedDevice": {"channel": 1, "channelType": "driveside",
95 "sasAttachedDeviceData": {"type": "expander", "alternateController": None, "drive": None,
96 "expander": "2000000000000000000000630001000000000000",
97 "remoteHostPortAddress": None,
98 "localController": None, "physicalLocation": None}}, "state": "optimal",
99 "miswireType": "None", "channelPortRef": "1F01000001010000000000000000000000000000",
100 "sasPhys": [{"phyIdentifier": 4, "isOperational": True}, {"phyIdentifier": 5, "isOperational": True},
101 {"phyIdentifier": 6, "isOperational": True}, {"phyIdentifier": 7, "isOperational": True}],
102 "portTypeData": {"portType": "endDevice", "portIdentifier": "500A098A4B28D004", "routingType": "__UNDEFINED"},
103 "portMode": "internal",
104 "domainNumber": 1, "attachedChannelPortRef": "0000000000000000000000000000000000000000", "discoveryStatus": 0},
105 "interfaceRef": "2201000000000000000000000000000000000000",
106 "physicalLocation": {"trayRef": "0000000000000000000000000000000000000000", "slot": 0,
107 "locationParent": {"refType": "generic", "controllerRef": None,
108 "symbolRef": "0000000000000000000000000000000000000000", "typedReference": None},
109 "locationPosition": 0, "label": ""}, "protectionInformationCapable": True, "oneWayMaxRate": "4400000000",
110 "bidirectionalMaxRate": "8400000000", "controllerId": None, "addressId": "500A098A4B28D004", "niceAddressId": "500A098A4B28D004",
111 "interfaceId": "2201000000000000000000000000000000000000", "basePortAddress": "500A098A4B28D00",
112 "id": "2201000000000000000000000000000000000000"}, "sata": None, "scsi": None}],
113 "netInterfaces": [{"interfaceType": "ethernet",
114 "ethernet": {"interfaceName": "wan0", "channel": 1, "speed": 1000, "ip": 175178176, "alias": "ictm0718s01c1-a",
115 "macAddr": "00A098A4B28D", "gatewayIp": 175177985, "subnetMask": -256, "bootpUsed": False, "rloginEnabled": True,
116 "reserved1": "0000000000000000", "setupError": False, "reserved2": "",
117 "interfaceRef": "2800070000000000000000000001000000000000", "linkStatus": "up", "ipv4Enabled": True,
118 "ipv4Address": "10.113.1.192", "ipv4SubnetMask": "255.255.255.0", "ipv4AddressConfigMethod": "configStatic",
119 "ipv6Enabled": False, "ipv6LocalAddress": {"address": "00000000000000000000000000000000",
120 "addressState": {"addressType": "typeInterface",
121 "interfaceAddressState": "configured",
122 "routerAddressState": "__UNDEFINED"}},
123 "ipv6PortStaticRoutableAddress": {"address": "00000000000000000000000000000000",
124 "addressState": {"addressType": "typeInterface",
125 "interfaceAddressState": "__UNDEFINED",
126 "routerAddressState": "__UNDEFINED"}},
127 "ipv6PortRoutableAddresses": [], "ipv6AddressConfigMethod": "configStatic", "fullDuplex": True,
128 "supportedSpeedSettings": ["speedAutoNegotiated", "speed10MbitHalfDuplex", "speed10MbitFullDuplex",
129 "speed100MbitHalfDuplex", "speed100MbitFullDuplex", "speed1000MbitFullDuplex"],
130 "configuredSpeedSetting": "speedAutoNegotiated", "currentSpeed": "speed1gig",
131 "physicalLocation": {"trayRef": "0E00000000000000000000000000000000000000", "slot": 0,
132 "locationParent": {"refType": "controller", "controllerRef": "070000000000000000000001",
133 "symbolRef": None, "typedReference": None}, "locationPosition": 1,
134 "label": "P1"}, "ipv4GatewayAddress": "10.113.1.1",
135 "controllerRef": "070000000000000000000001", "controllerSlot": 1,
136 "dnsProperties": {
137 "acquisitionProperties": {"dnsAcquisitionType": "stat",
138 "dnsServers": [
139 {"addressType": "ipv4", "ipv4Address": "10.193.0.250", "ipv6Address": None},
140 {"addressType": "ipv4", "ipv4Address": "10.192.0.250", "ipv6Address": None}]},
141 "dhcpAcquiredDnsServers": []},
142 "ntpProperties": {
143 "acquisitionProperties": {"ntpAcquisitionType": "stat", "ntpServers": [
144 {"addrType": "ipvx", "domainName": None,
145 "ipvxAddress": {"addressType": "ipv4", "ipv4Address": "216.239.35.0", "ipv6Address": None}},
146 {"addrType": "ipvx", "domainName": None,
147 "ipvxAddress": {"addressType": "ipv4", "ipv4Address": "216.239.35.4", "ipv6Address": None}}]},
148 "dhcpAcquiredNtpServers": []},
149 "id": "2800070000000000000000000001000000000000"}}],
150 "inventory": [], "reserved1": "000000000000000000000000", "reserved2": "", "hostBoardID": "None", "physicalCacheMemorySize": 4864,
151 "readyToRemove": False, "boardSubmodelID": "319", "submodelSupported": True, "oemPartNumber": "E2800A-8GB", "partNumber": "111-02829+C0 ",
152 "rtrAttributes": {"cruType": "dedicated", "parentCru": None, "rtrAttributeData": {"hasReadyToRemoveIndicator": False, "readyToRemove": False}},
153 "bootTime": "1563988406", "modelName": "2806",
154 "networkSettings": {"ipv4DefaultRouterAddress": "10.113.1.1",
155 "ipv6DefaultRouterAddress": {"address": "00000000000000000000000000000000",
156 "addressState": {"addressType": "typeInterface",
157 "interfaceAddressState": "__UNDEFINED", "routerAddressState": "__UNDEFINED"}},
158 "ipv6CandidateDefaultRouterAddresses": [],
159 "remoteAccessEnabled": True,
160 "dnsProperties": {"acquisitionProperties": {"dnsAcquisitionType": "stat",
161 "dnsServers": [
162 {"addressType": "ipv4", "ipv4Address": "10.193.0.250", "ipv6Address": None},
163 {"addressType": "ipv4", "ipv4Address": "10.192.0.250", "ipv6Address": None}]},
164 "dhcpAcquiredDnsServers": []},
165 "ntpProperties": {
166 "acquisitionProperties": {
167 "ntpAcquisitionType": "stat", "ntpServers": [
168 {"addrType": "ipvx", "domainName": None,
169 "ipvxAddress": {"addressType": "ipv4", "ipv4Address": "216.239.35.0", "ipv6Address": None}},
170 {"addrType": "ipvx", "domainName": None,
171 "ipvxAddress": {"addressType": "ipv4", "ipv4Address": "216.239.35.4", "ipv6Address": None}}]},
172 "dhcpAcquiredNtpServers": []}},
173 "repairPolicy": {"removalData": {"removalMethod": "__UNDEFINED", "rtrAttributes": None}, "replacementMethod": "__UNDEFINED"},
174 "flashCacheMemorySize": 419430400, "ctrlIocDumpData": {"iocDumpNeedsRetrieved": False, "iocDumpTag": 0, "timeStamp": "0"},
175 "locateInProgress": False, "hasTrayIdentityIndicator": False, "controllerErrorMode": "notInErrorMode",
176 "codeVersions": [{"codeModule": "raid", "versionString": "08.42.30.05"}, {"codeModule": "hypervisor", "versionString": "08.42.30.05"},
177 {"codeModule": "management", "versionString": "11.42.0000.0026"}, {"codeModule": "iom", "versionString": "11.42.0G00.0001"},
178 {"codeModule": "bundle", "versionString": "08.42.30.05"}, {"codeModule": "bundleDisplay", "versionString": "11.40.3R2"}],
179 "id": "070000000000000000000001"}],
180 "drive": [{"offline": False, "hotSpare": False, "invalidDriveData": False, "available": True, "pfa": False,
181 "driveRef": "0100000050000396AC882ED10000000000000000", "status": "optimal", "cause": "None",
182 "interfaceType": {"driveType": "sas", "fibre": None,
183 "sas": {"deviceName": "50000396AC882ED1",
184 "drivePortAddresses": [{"channel": 2, "portIdentifier": "50000396AC882ED3"},
185 {"channel": 1, "portIdentifier": "50000396AC882ED2"}]},
186 "scsi": None},
187 "physicalLocation": {"trayRef": "0E00000000000000000000000000000000000000", "slot": 6,
188 "locationParent": {"refType": "genericTyped", "controllerRef": None, "symbolRef": None,
189 "typedReference": {"componentType": "tray",
190 "symbolRef": "0E00000000000000000000000000000000000000"}},
191 "locationPosition": 6, "label": "5"}, "manufacturer": "TOSHIBA ",
192 "manufacturerDate": "1447200000", "productID": "PX04SVQ160 ", "serialNumber": "Y530A001T5MD", "softwareVersion": "MSB6", "blkSize": 512,
193 "usableCapacity": "1599784443904", "rawCapacity": "1600321314816", "worldWideName": "50000396AC882ED10000000000000000",
194 "currentVolumeGroupRef": "0000000000000000000000000000000000000000", "sparedForDriveRef": "0000000000000000000000000000000000000000",
195 "mirrorDrive": "0000000000000000000000000000000000000000", "nonRedundantAccess": False, "workingChannel": -1, "volumeGroupIndex": -1,
196 "currentSpeed": "speed12gig", "maxSpeed": "speed12gig", "uncertified": False, "hasDegradedChannel": False, "degradedChannels": [],
197 "phyDriveType": "sas", "spindleSpeed": 0, "rtrAttributes": {"cruType": "dedicated", "parentCru": None,
198 "rtrAttributeData": {"hasReadyToRemoveIndicator": False,
199 "readyToRemove": False}}, "reserved": "",
200 "phyDriveTypeData": {"phyDriveType": "sas", "sataDriveAttributes": None}, "pfaReason": "None", "bypassSource": [],
201 "repairPolicy": {"removalData": {"removalMethod": "self", "rtrAttributes": {"hasReadyToRemoveIndicator": False, "readyToRemove": False}},
202 "replacementMethod": "self"}, "fdeCapable": True, "fdeEnabled": False, "fdeLocked": False,
203 "lockKeyID": "0000000000000000000000000000000000000000",
204 "ssdWearLife": {"averageEraseCountPercent": 18, "spareBlocksRemainingPercent": 91, "isWearLifeMonitoringSupported": True,
205 "percentEnduranceUsed": 18}, "driveMediaType": "ssd", "fpgaVersion": "",
206 "protectionInformationCapabilities": {"protectionInformationCapable": True, "protectionType": "type2Protection"},
207 "protectionInformationCapable": False, "protectionType": "type0Protection", "interposerPresent": False,
208 "interposerRef": "0000000000000000000000000000000000000000", "currentCommandAgingTimeout": 6, "defaultCommandAgingTimeout": 6,
209 "driveTemperature": {"currentTemp": 25, "refTemp": 64}, "blkSizePhysical": 4096, "lowestAlignedLBA": "0", "removed": False,
210 "locateInProgress": False, "fipsCapable": False, "firmwareVersion": "MSB6", "lockKeyIDValue": None,
211 "id": "0100000050000396AC882ED10000000000000000"},
212 {"offline": False, "hotSpare": False, "invalidDriveData": False, "available": True, "pfa": False,
213 "driveRef": "0100000050000396AC882EDD0000000000000000", "status": "optimal", "cause": "None",
214 "interfaceType": {"driveType": "sas", "fibre": None,
215 "sas": {"deviceName": "50000396AC882EDD",
216 "drivePortAddresses": [{"channel": 2, "portIdentifier": "50000396AC882EDF"},
217 {"channel": 1, "portIdentifier": "50000396AC882EDE"}]},
218 "scsi": None},
219 "physicalLocation": {"trayRef": "0E00000000000000000000000000000000000000", "slot": 8,
220 "locationParent": {"refType": "genericTyped", "controllerRef": None, "symbolRef": None,
221 "typedReference": {"componentType": "tray",
222 "symbolRef": "0E00000000000000000000000000000000000000"}},
223 "locationPosition": 8, "label": "7"}, "manufacturer": "TOSHIBA ",
224 "manufacturerDate": "1447200000", "productID": "PX04SVQ160 ", "serialNumber": "Y530A004T5MD", "softwareVersion": "MSB6", "blkSize": 512,
225 "usableCapacity": "1599784443904", "rawCapacity": "1600321314816", "worldWideName": "50000396AC882EDD0000000000000000",
226 "currentVolumeGroupRef": "0000000000000000000000000000000000000000", "sparedForDriveRef": "0000000000000000000000000000000000000000",
227 "mirrorDrive": "0000000000000000000000000000000000000000", "nonRedundantAccess": False, "workingChannel": -1, "volumeGroupIndex": -1,
228 "currentSpeed": "speed12gig", "maxSpeed": "speed12gig", "uncertified": False, "hasDegradedChannel": False, "degradedChannels": [],
229 "phyDriveType": "sas", "spindleSpeed": 0, "rtrAttributes": {"cruType": "dedicated", "parentCru": None,
230 "rtrAttributeData": {"hasReadyToRemoveIndicator": False,
231 "readyToRemove": False}}, "reserved": "",
232 "phyDriveTypeData": {"phyDriveType": "sas", "sataDriveAttributes": None}, "pfaReason": "None", "bypassSource": [],
233 "repairPolicy": {"removalData": {"removalMethod": "self", "rtrAttributes": {"hasReadyToRemoveIndicator": False, "readyToRemove": False}},
234 "replacementMethod": "self"}, "fdeCapable": True, "fdeEnabled": False, "fdeLocked": False,
235 "lockKeyID": "0000000000000000000000000000000000000000",
236 "ssdWearLife": {"averageEraseCountPercent": 18, "spareBlocksRemainingPercent": 91, "isWearLifeMonitoringSupported": True,
237 "percentEnduranceUsed": 18}, "driveMediaType": "ssd", "fpgaVersion": "",
238 "protectionInformationCapabilities": {"protectionInformationCapable": True, "protectionType": "type2Protection"},
239 "protectionInformationCapable": False, "protectionType": "type0Protection", "interposerPresent": False,
240 "interposerRef": "0000000000000000000000000000000000000000", "currentCommandAgingTimeout": 6, "defaultCommandAgingTimeout": 6,
241 "driveTemperature": {"currentTemp": 25, "refTemp": 64}, "blkSizePhysical": 4096, "lowestAlignedLBA": "0", "removed": False,
242 "locateInProgress": False, "fipsCapable": False, "firmwareVersion": "MSB6", "lockKeyIDValue": None,
243 "id": "0100000050000396AC882EDD0000000000000000"}],
244 "volumeGroup": [
245 {"sequenceNum": 1, "offline": False, "raidLevel": "raid6", "worldWideName": "600A098000A4B9D10000380A5D4AAC3C",
246 "volumeGroupRef": "04000000600A098000A4B9D10000380A5D4AAC3C", "reserved1": "000000000000000000000000", "reserved2": "",
247 "trayLossProtection": False, "label": "beegfs_storage_vg", "state": "complete", "spindleSpeedMatch": True, "spindleSpeed": 10500,
248 "isInaccessible": False, "securityType": "capable", "drawerLossProtection": False, "protectionInformationCapable": False,
249 "protectionInformationCapabilities": {"protectionInformationCapable": True, "protectionType": "type2Protection"},
250 "volumeGroupData": {"type": "unknown", "diskPoolData": None},
251 "usage": "standard", "driveBlockFormat": "allNative", "reservedSpaceAllocated": False, "securityLevel": "fde", "usedSpace": "1099511627776",
252 "totalRaidedSpace": "9597654597632",
253 "extents": [{"sectorOffset": "268435456", "rawCapacity": "8498142969856", "raidLevel": "raid6",
254 "volumeGroupRef": "04000000600A098000A4B9D10000380A5D4AAC3C", "freeExtentRef": "03000000600A098000A4B9D10000380A5D4AAC3C",
255 "reserved1": "000000000000000000000000", "reserved2": ""}],
256 "largestFreeExtentSize": "8498142969856", "raidStatus": "optimal", "freeSpace": "8498142969856", "drivePhysicalType": "sas",
257 "driveMediaType": "hdd", "normalizedSpindleSpeed": "spindleSpeed10k", "diskPool": False,
258 "id": "04000000600A098000A4B9D10000380A5D4AAC3C", "name": "beegfs_storage_vg"}], "volume": [
259 {"offline": False, "extremeProtection": False, "volumeHandle": 0, "raidLevel": "raid6", "sectorOffset": "0",
260 "worldWideName": "600A098000A4B28D00003E435D4AAC54", "label": "beegfs_storage_01_1", "blkSize": 512, "capacity": "1099511627776",
261 "reconPriority": 1, "segmentSize": 131072, "action": "None",
262 "cache": {"cwob": False, "enterpriseCacheDump": False, "mirrorActive": True, "mirrorEnable": True, "readCacheActive": False,
263 "readCacheEnable": False, "writeCacheActive": True, "writeCacheEnable": True, "cacheFlushModifier": "flush10Sec",
264 "readAheadMultiplier": 1}, "mediaScan": {"enable": True, "parityValidationEnable": True},
265 "volumeRef": "02000000600A098000A4B28D00003E435D4AAC54", "status": "optimal", "volumeGroupRef": "04000000600A098000A4B9D10000380A5D4AAC3C",
266 "currentManager": "070000000000000000000001", "preferredManager": "070000000000000000000001",
267 "perms": {"mapToLUN": True, "snapShot": True, "format": True, "reconfigure": True, "mirrorPrimary": True, "mirrorSecondary": True,
268 "copySource": True, "copyTarget": True, "readable": True, "writable": True, "rollback": True, "mirrorSync": True, "newImage": True,
269 "allowDVE": True, "allowDSS": True, "concatVolumeMember": False, "flashReadCache": True, "asyncMirrorPrimary": True,
270 "asyncMirrorSecondary": True, "pitGroup": True, "cacheParametersChangeable": True, "allowThinManualExpansion": False,
271 "allowThinGrowthParametersChange": False},
272 "mgmtClientAttribute": 0, "dssPreallocEnabled": False, "dssMaxSegmentSize": 0, "preReadRedundancyCheckEnabled": False,
273 "protectionInformationCapable": False, "protectionType": "type0Protection", "applicationTagOwned": True,
274 "repairedBlockCount": 0, "extendedUniqueIdentifier": "", "cacheMirroringValidateProtectionInformation": False,
275 "expectedProtectionInformationAppTag": 0, "volumeUse": "standardVolume", "volumeFull": False, "volumeCopyTarget": False, "volumeCopySource": False,
276 "pitBaseVolume": False, "asyncMirrorTarget": False, "asyncMirrorSource": False, "remoteMirrorSource": False, "remoteMirrorTarget": False,
277 "diskPool": False, "flashCached": False, "increasingBy": "0", "metadata": [], "dataAssurance": False, "objectType": "volume",
278 "listOfMappings": [
279 {"lunMappingRef": "88000000A1010000000000000000000000000000", "lun": 1, "ssid": 0, "perms": 15,
280 "volumeRef": "02000000600A098000A4B28D00003E435D4AAC54", "type": "host", "mapRef": "84000000600A098000A4B28D00303D065D430118",
281 "id": "88000000A1010000000000000000000000000000"}],
282 "mapped": True, "currentControllerId": "070000000000000000000001",
283 "cacheSettings": {"cwob": False, "enterpriseCacheDump": False, "mirrorActive": True, "mirrorEnable": True, "readCacheActive": False,
284 "readCacheEnable": False, "writeCacheActive": True, "writeCacheEnable": True, "cacheFlushModifier": "flush10Sec",
285 "readAheadMultiplier": 1},
286 "thinProvisioned": False, "preferredControllerId": "070000000000000000000001", "totalSizeInBytes": "1099511627776", "onlineVolumeCopy": False,
287 "wwn": "600A098000A4B28D00003E435D4AAC54", "name": "beegfs_storage_01_1", "id": "02000000600A098000A4B28D00003E435D4AAC54"}],
288 "storagePoolBundle": {"cluster": [], "host": [
289 {"hostRef": "84000000600A098000A4B28D00303D005D430107", "clusterRef": "0000000000000000000000000000000000000000", "label": "test",
290 "isSAControlled": False, "confirmLUNMappingCreation": False, "hostTypeIndex": 28, "protectionInformationCapableAccessMethod": True,
291 "isLargeBlockFormatHost": False, "isLun0Restricted": False, "ports": [],
292 "initiators": [
293 {"initiatorRef": "89000000600A098000A4B9D1003037005D4300F5",
294 "nodeName": {"ioInterfaceType": "iscsi", "iscsiNodeName": "iqn.iscsi_tests1", "remoteNodeWWN": None, "nvmeNodeName": None},
295 "alias": {"ioInterfaceType": "iscsi", "iscsiAlias": ""}, "label": "iscsi_test1",
296 "configuredAuthMethods": {"authMethodData": [{"authMethod": "None", "chapSecret": None}]},
297 "hostRef": "84000000600A098000A4B28D00303D005D430107", "initiatorInactive": False, "id": "89000000600A098000A4B9D1003037005D4300F5"}],
298 "hostSidePorts": [{"type": "iscsi", "address": "iqn.iscsi_tests1", "label": "iscsi_test1"}],
299 "id": "84000000600A098000A4B28D00303D005D430107", "name": "test"},
300 {"hostRef": "84000000600A098000A4B9D1003037035D4300F8", "clusterRef": "0000000000000000000000000000000000000000", "label": "test2",
301 "isSAControlled": True, "confirmLUNMappingCreation": False, "hostTypeIndex": 28, "protectionInformationCapableAccessMethod": True,
302 "isLargeBlockFormatHost": False, "isLun0Restricted": False, "ports": [],
303 "initiators": [
304 {"initiatorRef": "89000000600A098000A4B9D1003037075D4300F9",
305 "nodeName": {"ioInterfaceType": "iscsi", "iscsiNodeName": "iqn.iscsi_tests2", "remoteNodeWWN": None, "nvmeNodeName": None},
306 "alias": {"ioInterfaceType": "iscsi", "iscsiAlias": ""}, "label": "iscsi_test2",
307 "configuredAuthMethods": {"authMethodData": [{"authMethod": "None", "chapSecret": None}]},
308 "hostRef": "84000000600A098000A4B9D1003037035D4300F8", "initiatorInactive": False, "id": "89000000600A098000A4B9D1003037075D4300F9"}],
309 "hostSidePorts": [{"type": "iscsi", "address": "iqn.iscsi_tests2", "label": "iscsi_test2"}],
310 "id": "84000000600A098000A4B9D1003037035D4300F8", "name": "test2"},
311 {"hostRef": "84000000600A098000A4B28D00303D065D430118", "clusterRef": "0000000000000000000000000000000000000000", "label": "beegfs_storage1",
312 "isSAControlled": False, "confirmLUNMappingCreation": False, "hostTypeIndex": 28, "protectionInformationCapableAccessMethod": True,
313 "isLargeBlockFormatHost": False, "isLun0Restricted": False, "ports": [],
314 "initiators": [
315 {"initiatorRef": "89000000600A098000A4B28D00303CF55D4300E3",
316 "nodeName": {"ioInterfaceType": "iscsi", "iscsiNodeName": "iqn.1993-08.org.debian.beegfs-storage1:01:b0621126818", "remoteNodeWWN": None,
317 "nvmeNodeName": None}, "alias": {"ioInterfaceType": "iscsi", "iscsiAlias": ""}, "label": "beegfs_storage1_iscsi_0",
318 "configuredAuthMethods": {"authMethodData": [{"authMethod": "None", "chapSecret": None}]},
319 "hostRef": "84000000600A098000A4B28D00303D065D430118", "initiatorInactive": False, "id": "89000000600A098000A4B28D00303CF55D4300E3"}],
320 "hostSidePorts": [{"type": "iscsi", "address": "iqn.1993-08.org.debian.beegfs-storage1:01:b0621126818", "label": "beegfs_storage1_iscsi_0"}],
321 "id": "84000000600A098000A4B28D00303D065D430118", "name": "beegfs_storage1"},
322 {"hostRef": "84000000600A098000A4B9D10030370B5D430109", "clusterRef": "0000000000000000000000000000000000000000", "label": "beegfs_metadata1",
323 "isSAControlled": False, "confirmLUNMappingCreation": False, "hostTypeIndex": 28, "protectionInformationCapableAccessMethod": True,
324 "isLargeBlockFormatHost": False, "isLun0Restricted": False, "ports": [],
325 "initiators": [
326 {"initiatorRef": "89000000600A098000A4B28D00303CFC5D4300F7",
327 "nodeName": {"ioInterfaceType": "iscsi", "iscsiNodeName": "iqn.1993-08.org.debian.beegfs-metadata:01:69e4efdf30b8", "remoteNodeWWN": None,
328 "nvmeNodeName": None}, "alias": {"ioInterfaceType": "iscsi", "iscsiAlias": ""}, "label": "beegfs_metadata1_iscsi_0",
329 "configuredAuthMethods": {"authMethodData": [{"authMethod": "None", "chapSecret": None}]},
330 "hostRef": "84000000600A098000A4B9D10030370B5D430109", "initiatorInactive": False, "id": "89000000600A098000A4B28D00303CFC5D4300F7"}],
331 "hostSidePorts": [{"type": "iscsi", "address": "iqn.1993-08.org.debian.beegfs-metadata:01:69e4efdf30b8", "label": "beegfs_metadata1_iscsi_0"}],
332 "id": "84000000600A098000A4B9D10030370B5D430109", "name": "beegfs_metadata1"}], "lunMapping": [
333 {"lunMappingRef": "8800000000000000000000000000000000000000", "lun": 7, "ssid": 16384, "perms": 15,
334 "volumeRef": "21000000600A098000A4B28D000027EC5CF10481", "type": "all", "mapRef": "0000000000000000000000000000000000000000",
335 "id": "8800000000000000000000000000000000000000"},
336 {"lunMappingRef": "880000008B010000000000000000000000000000", "lun": 7, "ssid": 16384, "perms": 15,
337 "volumeRef": "21000000600A098000A4B28D000027EC5CF10481", "type": "host", "mapRef": "84000000600A098000A4B28D00303D065D430118",
338 "id": "880000008B010000000000000000000000000000"},
339 {"lunMappingRef": "8800000090010000000000000000000000000000", "lun": 7, "ssid": 16384, "perms": 15,
340 "volumeRef": "21000000600A098000A4B28D000027EC5CF10481", "type": "host", "mapRef": "84000000600A098000A4B9D10030370B5D430109",
341 "id": "8800000090010000000000000000000000000000"},
342 {"lunMappingRef": "8800000092010000000000000000000000000000", "lun": 7, "ssid": 16384, "perms": 15,
343 "volumeRef": "21000000600A098000A4B28D000027EC5CF10481", "type": "host", "mapRef": "84000000600A098000A4B28D00303D005D430107",
344 "id": "8800000092010000000000000000000000000000"}, {"lunMappingRef": "88000000A1010000000000000000000000000000", "lun": 1, "ssid": 0, "perms": 15,
345 "volumeRef": "02000000600A098000A4B28D00003E435D4AAC54", "type": "host",
346 "mapRef": "84000000600A098000A4B28D00303D065D430118",
347 "id": "88000000A1010000000000000000000000000000"}]}, "highLevelVolBundle": {"pit": []}}
348
349 EXPECTED_GET_ARRAY_FACTS = {'facts_from_proxy': False,
350 'netapp_controllers': [{'name': 'A', 'serial': '021619039162', 'status': 'optimal'}],
351 'netapp_default_hostgroup_access_volume_lun': 7,
352 'netapp_disks': [
353 {'available': True, 'firmware_version': 'MSB6', 'id': '0100000050000396AC882ED10000000000000000', 'media_type': 'ssd',
354 'product_id': 'PX04SVQ160 ', 'serial_number': 'Y530A001T5MD', 'status': 'optimal',
355 'tray_ref': '0E00000000000000000000000000000000000000', 'usable_bytes': '1599784443904'},
356 {'available': True, 'firmware_version': 'MSB6', 'id': '0100000050000396AC882EDD0000000000000000', 'media_type': 'ssd',
357 'product_id': 'PX04SVQ160 ', 'serial_number': 'Y530A004T5MD', 'status': 'optimal',
358 'tray_ref': '0E00000000000000000000000000000000000000', 'usable_bytes': '1599784443904'}],
359 'netapp_driveside_interfaces': [{'controller': 'A', 'interface_speed': '12g', 'interface_type': 'sas'}],
360 'netapp_enabled_features': ['autoCodeSync', 'autoLunTransfer', 'bundleMigration', 'driveSlotLimit', 'flashReadCache',
361 'mixedDriveTypes', 'performanceTier', 'protectionInformation', 'raid6', 'secureVolume',
362 'ssdSupport', 'stagedDownload', 'storagePoolsType2', 'subLunsAllowed',
363 'totalNumberOfArvmMirrorsPerArray', 'totalNumberOfPitsPerArray',
364 'totalNumberOfThinVolumesPerArray'],
365 'netapp_host_groups': [{'hosts': ['test',
366 'test2',
367 'beegfs_storage1',
368 'beegfs_metadata1'],
369 'id': '0000000000000000000000000000000000000000',
370 'name': 'default_hostgroup'}],
371 'netapp_host_types': [{'index': 0, 'type': 'FactoryDefault'}, {'index': 1, 'type': 'W2KNETNCL'},
372 {'index': 27, 'type': 'LnxTPGSALUA_SF'}, {'index': 28, 'type': 'LnxDHALUA'}],
373 'netapp_hosts': [
374 {'group_id': '0000000000000000000000000000000000000000', 'host_type_index': 28,
375 'hosts_reference': '84000000600A098000A4B28D00303D005D430107',
376 'id': '84000000600A098000A4B28D00303D005D430107', 'name': 'test',
377 'ports': [{'address': 'iqn.iscsi_tests1', 'label': 'iscsi_test1', 'type': 'iscsi'}]},
378 {'group_id': '0000000000000000000000000000000000000000', 'host_type_index': 28,
379 'hosts_reference': '84000000600A098000A4B9D1003037035D4300F8',
380 'id': '84000000600A098000A4B9D1003037035D4300F8', 'name': 'test2',
381 'ports': [{'address': 'iqn.iscsi_tests2', 'label': 'iscsi_test2', 'type': 'iscsi'}]},
382 {'group_id': '0000000000000000000000000000000000000000', 'host_type_index': 28,
383 'hosts_reference': '84000000600A098000A4B28D00303D065D430118',
384 'id': '84000000600A098000A4B28D00303D065D430118', 'name': 'beegfs_storage1',
385 'ports': [{'address': 'iqn.1993-08.org.debian.beegfs-storage1:01:b0621126818', 'label': 'beegfs_storage1_iscsi_0',
386 'type': 'iscsi'}]},
387 {'group_id': '0000000000000000000000000000000000000000', 'host_type_index': 28,
388 'hosts_reference': '84000000600A098000A4B9D10030370B5D430109',
389 'id': '84000000600A098000A4B9D10030370B5D430109', 'name': 'beegfs_metadata1',
390 'ports': [{'address': 'iqn.1993-08.org.debian.beegfs-metadata:01:69e4efdf30b8', 'label': 'beegfs_metadata1_iscsi_0',
391 'type': 'iscsi'}]}],
392 'netapp_hostside_interfaces': [{'fc': [], 'ib': [],
393 'iscsi': [
394 {'controller': 'A', 'current_interface_speed': '10g', 'ipv4_address': '10.10.11.110',
395 'ipv4_enabled': True,
396 'ipv4_gateway': '0.0.0.0', 'ipv4_subnet_mask': '255.255.255.0', 'ipv6_enabled': True,
397 'iqn': 'iqn.1992-08.com.netapp:2806.600a098000a4b28d000000005cf10481', 'link_status': 'up',
398 'mtu': 9000,
399 'supported_interface_speeds': ['1g', '10g']}], 'sas': []}],
400 'netapp_luns_by_target': {'beegfs_metadata1': [],
401 'beegfs_storage1': [('beegfs_storage_01_1', 1)],
402 'default_hostgroup': [('beegfs_storage_01_1', 1)],
403 'test': [],
404 'test2': []},
405 'netapp_management_interfaces': [
406 {'alias': 'ictm0718s01c1-a', 'channel': 1, 'controller': 'A', 'dns_config_method': 'stat',
407 'dns_servers': [{'addressType': 'ipv4', 'ipv4Address': '10.193.0.250', 'ipv6Address': None},
408 {'addressType': 'ipv4', 'ipv4Address': '10.192.0.250', 'ipv6Address': None}],
409 'ipv4_address': '10.113.1.192',
410 'ipv4_address_config_method': 'static', 'ipv4_enabled': True, 'ipv4_gateway': '10.113.1.1',
411 'ipv4_subnet_mask': '255.255.255.0', 'ipv6_enabled': False, 'link_status': 'up',
412 'mac_address': '00A098A4B28D', 'name': 'wan0', 'ntp_config_method': 'stat',
413 'ntp_servers': [
414 {'addrType': 'ipvx', 'domainName': None,
415 'ipvxAddress': {'addressType': 'ipv4', 'ipv4Address': '216.239.35.0', 'ipv6Address': None}},
416 {'addrType': 'ipvx', 'domainName': None,
417 'ipvxAddress': {'addressType': 'ipv4', 'ipv4Address': '216.239.35.4', 'ipv6Address': None}}],
418 'remote_ssh_access': True}],
419 'netapp_storage_array': {'cache_block_sizes': [4096, 8192, 16384, 32768], 'chassis_serial': '021633035190',
420 'firmware': '08.42.30.05', 'name': 'ictm0718s01c1',
421 'segment_sizes': [32768, 65536, 131072, 262144, 524288, 495616, 655360, 1982464],
422 'wwn': '600A098000A4B28D000000005CF10481'},
423 'netapp_storage_pools': [
424 {'available_capacity': '8498142969856', 'id': '04000000600A098000A4B9D10000380A5D4AAC3C', 'name': 'beegfs_storage_vg',
425 'total_capacity': '9597654597632', 'used_capacity': '1099511627776'}],
426 'netapp_volumes': [
427 {'capacity': '1099511627776', 'id': '02000000600A098000A4B28D00003E435D4AAC54', 'is_thin_provisioned': False,
428 'name': 'beegfs_storage_01_1', 'parent_storage_pool_id': '04000000600A098000A4B9D10000380A5D4AAC3C', 'workload': []}],
429 'netapp_volumes_by_initiators': {'beegfs_metadata1': [],
430 'beegfs_storage1': [{'id': '02000000600A098000A4B28D00003E435D4AAC54',
431 'meta_data': {},
432 'name': 'beegfs_storage_01_1',
433 'raid_level': 'raid6',
434 'segment_size_kb': 128,
435 'stripe_count': -2,
436 'workload_name': '',
437 'wwn': '600A098000A4B28D00003E435D4AAC54'}],
438
439 'test': [], 'test2': []},
440 'netapp_workload_tags': [
441 {'attributes': [{'key': 'profileId', 'value': 'ansible_workload_1'}], 'id': '4200000001000000000000000000000000000000',
442 'name': 'beegfs_metadata'},
443 {'attributes': [{'key': 'profileId', 'value': 'Other_1'}], 'id': '4200000002000000000000000000000000000000',
444 'name': 'other_workload_1'}], 'snapshot_images': [], 'ssid': '1'}
445
446 @contextmanager
447 def _set_args(self, **kwargs):
448 module_args = self.REQUIRED_PARAMS.copy()
449 if kwargs is not None:
450 module_args.update(kwargs)
451 with patch_module_args(module_args):
452 yield
453
454 def test_get_controllers_pass(self):
455 """Verify get_controllers returns the expected results."""
456 with self._set_args():
457 facts = Facts()
458 with mock.patch(self.REQUEST_FUNC, return_value=(200, ["070000000000000000000002", "070000000000000000000001"])):
459 self.assertEqual(facts.get_controllers(), {"070000000000000000000001": "A", "070000000000000000000002": "B"})
460
461 def test_get_controllers_fail(self):
462 """Verify get_controllers throws the expected exceptions."""
463 with self._set_args():
464 facts = Facts()
465 with self.assertRaisesRegex(AnsibleFailJson, "Failed to retrieve controller list!"):
466 with mock.patch(self.REQUEST_FUNC, return_value=Exception()):
467 facts.get_controllers()
468
469 @unittest.skip("Test needs to be reworked.")
470 def test_get_array_facts_pass(self):
471 """Verify get_array_facts method returns expected results."""
472 self.maxDiff = None
473 with self._set_args():
474 facts = Facts()
475 facts.is_embedded = lambda: True
476 with mock.patch(self.GET_CONTROLLERS_FUNC, return_value={"070000000000000000000001": "A", "070000000000000000000002": "B"}):
477 with mock.patch(self.REQUEST_FUNC, side_effect=[(200, self.GRAPH_RESPONSE), (200, self.WORKLOAD_RESPONSE)]):
478 self.assertEqual(facts.get_array_facts(), self.EXPECTED_GET_ARRAY_FACTS)