HewlettPackard / POSH-HPEOneView

PowerShell language bindings library for HPE OneView.
http://hewlettpackard.github.io/POSH-HPEOneView/
125 stars 52 forks source link

Enable-OVComposerIlo Parameter Validation Failure #622

Open olant opened 1 year ago

olant commented 1 year ago

$InputObject is [ValidateNotNullorEmpty()], but this does not allow an unconfigured composer ilo object as Parameter:

PS> $Appliance = Get-OVComposerIloStatus
PS> Enable-OVComposerIlo -InputObject $ComposerAppliance -Hostname Myilohost.domia[...]

Enable-OVComposerIlo : Cannot validate argument on parameter 'InputObject'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then
try the command again.
At line:1 char:35
+ Enable-OVComposerIlo -InputObject $_ilo -Username localadmin -Passwor ...
+                                   ~~~~~
    + CategoryInfo          : InvalidData: (:) [Enable-OVComposerIlo], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Enable-OVComposerIlo

Object is not empty:

PS> $Appliance
Name                : XXXX, appliance bay 1
ID                  : CNXXXX
Model               : SynergyComposer2
Role                : Active
Version             : 6.60.2-0467825
Enclosure           : @{XXX}
BayNumber           : 1
IsExtAccessible     : True
IloConfig           :
Uri                 : /rest/hw-appliances/CNXXX
ApplianceConnection : XXX

A quick hack (remove parameter validation from module) makes it work.

ChrisLynchHPE commented 1 year ago

While the variable isn't null, you are not providing the correct variable in your Cmdlet call. You are passing $ComposerAppliance instead of $Appliance. And the exception error contains another variable called $_ilo. Are you sure you are passing the correct variable name?

olant commented 1 year ago

Sorry, I tried to write the issue in a short form and mixed up some lines. Yes, I do pass the correct variable and once I remove "[ValidateNotNullorEmpty()]" from the functtion's param definition for "[Object]$InputObject" it works fine and configures iLO settings as requested.

ChrisLynchHPE commented 1 year ago

The [ValidateNotNullorEmpty()] is very intentional in Cmdlet design and cannot be removed. This is a standard PowerShell mechanism, and nothing to do with the internals of the Cmdlet. So, you are passing something incorrectly that happens to be null or contain a null entry within an array.

Are you by chance attempting to this with real hardware?

olant commented 1 year ago

Yes, I have real hardware. I followed the example to be sure:

PS C:\Users>  $SecurePassword = Read-Host "Password" -AsSecureString
Password: ************
PS C:\Users> $ComposerAppliance = Get-OVComposerIloStatus
PS C:\Users> $ComposerAppliance

Name                : XXXX, appliance bay 1
ID                  : CNX14000RJ
Model               : SynergyComposer2
Role                : Active
Version             : 6.60.2-0467825
[...]
BayNumber           : 1
IsExtAccessible     : True
IloConfig           :
Uri                 : /rest/hw-appliances/CNX14000RJ
ApplianceConnection : XXX

PS C:\Users> Enable-OVComposerIlo -InputObject $ComposerAppliance -Hostname Myilohost.domian.com -Username iloadm -Password $SecurePassword -IPv4Address 10.148.23.10 -IPv4SubnetMask 24 -IPv4Gateway 10.148.23.1 -IPv4DnsServer 10.10.4.23
Enable-OVComposerIlo : Cannot validate argument on parameter 'InputObject'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then
try the command again.
At line:1 char:35
+ Enable-OVComposerIlo -InputObject $ComposerAppliance -Hostname Myiloh ...
+                                   ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Enable-OVComposerIlo], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Enable-OVComposerIlo
ChrisLynchHPE commented 1 year ago

Can you do this:

$ComposerAppliance | Measure-Object

$ComposerAppliance | ConvertTo-Json -Depth 99

Then reply with the results? I'm suspecting that something null is being returned from Get-OVComposerIloStatus.

olant commented 1 year ago
PS C:\Users\> $ComposerAppliance|Measure-Object

Count    : 1
Average  :
Sum      :
Maximum  :
Minimum  :
Property :

PS C:\Users\> $ComposerAppliance|ConvertTo-Json -Depth 99
{
    "Name":  "0MSYN02, appliance bay 1",
    "ID":  "CNX14000RJ",
    "Model":  "SynergyComposer2",
    "Role":  0,
    "Version":  {
                    "BuildVersion":  null,
                    "MajorVersion":  "6",
                    "MinorVersion":  60,
                    "PatchVersion":  2,
                    "PrereleaseVersion":  "0467825"
                },
    "Enclosure":  {
                      "type":  "EnclosureV8",
                      "uri":  "/rest/enclosures/P06011CNX240004M",
                      "category":  "enclosures",
                      "eTag":  "2022-11-30T16:36:01.771Z",
                      "created":  "2022-11-15T03:51:35.718Z",
                      "modified":  "2022-11-30T16:36:01.771Z",
                      "refreshState":  "NotRefreshing",
                      "stateReason":  "None",
                      "enclosureType":  "SY12000",
                      "enclosureTypeUri":  "/rest/enclosure-types/SY12000",
                      "enclosureModel":  "Synergy 12000 Frame",
                      "uuid":  "P06011CNX240004M",
                      "serialNumber":  "CNX240004M",
                      "partNumber":  "P06011-B21",
                      "reconfigurationState":  "NotReapplyingConfiguration",
                      "uidState":  "Off",
                      "licensingIntent":  "NotApplicable",
                      "deviceBayCount":  12,
                      "deviceBays":  [
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  1,
                                             "model":  null,
                                             "devicePresence":  "Present",
                                             "profileUri":  "/rest/server-profiles/2e4a4cc5-ff20-417f-adfa-e3cd41989ed2",
                                             "deviceUri":  "/rest/server-hardware/39313738-3034-4E43-5832-343030303447",
                                             "coveredByProfile":  "/rest/server-profiles/2e4a4cc5-ff20-417f-adfa-e3cd41989ed2",
                                             "coveredByDevice":  "/rest/server-hardware/39313738-3034-4E43-5832-343030303447",
                                             "ipv4Setting":  {
                                                                 "ipAddress":  "172.16.174.191",
                                                                 "mode":  "Manual",
                                                                 "ipAssignmentState":  "Assigned",
                                                                 "ipRangeUri":  null
                                                             },
                                             "ipv6Setting":  {
                                                                 "ipAddress":  null,
                                                                 "mode":  "External",
                                                                 "ipAssignmentState":  "None",
                                                                 "ipRangeUri":  null
                                                             },
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/1",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  false,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "SingleHeightSingleWide",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  false,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  458,
                                             "serialConsole":  true
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  2,
                                             "model":  null,
                                             "devicePresence":  "Present",
                                             "profileUri":  "/rest/server-profiles/43661871-cf9f-4918-b8d2-1f50bfd7daca",
                                             "deviceUri":  "/rest/server-hardware/39313738-3034-4E43-5832-343030303448",
                                             "coveredByProfile":  "/rest/server-profiles/43661871-cf9f-4918-b8d2-1f50bfd7daca",
                                             "coveredByDevice":  "/rest/server-hardware/39313738-3034-4E43-5832-343030303448",
                                             "ipv4Setting":  {
                                                                 "ipAddress":  "172.16.174.192",
                                                                 "mode":  "Manual",
                                                                 "ipAssignmentState":  "Assigned",
                                                                 "ipRangeUri":  null
                                                             },
                                             "ipv6Setting":  {
                                                                 "ipAddress":  null,
                                                                 "mode":  "External",
                                                                 "ipAssignmentState":  "None",
                                                                 "ipRangeUri":  null
                                                             },
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/2",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  false,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "SingleHeightSingleWide",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  false,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  458,
                                             "serialConsole":  true
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  3,
                                             "model":  null,
                                             "devicePresence":  "Present",
                                             "profileUri":  "/rest/server-profiles/33b9367c-edfb-434d-b22c-bf9aed6c28ab",
                                             "deviceUri":  "/rest/server-hardware/39313738-3034-4E43-5832-34303030344A",
                                             "coveredByProfile":  "/rest/server-profiles/33b9367c-edfb-434d-b22c-bf9aed6c28ab",
                                             "coveredByDevice":  "/rest/server-hardware/39313738-3034-4E43-5832-34303030344A",
                                             "ipv4Setting":  {
                                                                 "ipAddress":  "172.16.174.193",
                                                                 "mode":  "Manual",
                                                                 "ipAssignmentState":  "Assigned",
                                                                 "ipRangeUri":  null
                                                             },
                                             "ipv6Setting":  {
                                                                 "ipAddress":  null,
                                                                 "mode":  "External",
                                                                 "ipAssignmentState":  "None",
                                                                 "ipRangeUri":  null
                                                             },
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/3",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  false,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "SingleHeightSingleWide",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  false,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  458,
                                             "serialConsole":  true
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  4,
                                             "model":  null,
                                             "devicePresence":  "Present",
                                             "profileUri":  "/rest/server-profiles/ff2bb34c-00c8-442d-b7f7-e9872b54fb94",
                                             "deviceUri":  "/rest/server-hardware/39313738-3034-4E43-5832-34303030344B",
                                             "coveredByProfile":  "/rest/server-profiles/ff2bb34c-00c8-442d-b7f7-e9872b54fb94",
                                             "coveredByDevice":  "/rest/server-hardware/39313738-3034-4E43-5832-34303030344B",
                                             "ipv4Setting":  {
                                                                 "ipAddress":  "172.16.174.194",
                                                                 "mode":  "Manual",
                                                                 "ipAssignmentState":  "Assigned",
                                                                 "ipRangeUri":  null
                                                             },
                                             "ipv6Setting":  {
                                                                 "ipAddress":  null,
                                                                 "mode":  "External",
                                                                 "ipAssignmentState":  "None",
                                                                 "ipRangeUri":  null
                                                             },
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/4",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  false,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "SingleHeightSingleWide",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  false,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  458,
                                             "serialConsole":  true
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  5,
                                             "model":  null,
                                             "devicePresence":  "Absent",
                                             "profileUri":  null,
                                             "deviceUri":  null,
                                             "coveredByProfile":  null,
                                             "coveredByDevice":  null,
                                             "ipv4Setting":  null,
                                             "ipv6Setting":  null,
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/5",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  true,
                                             "availableForFullHeightProfile":  true,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "Empty",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  true,
                                             "availableForFullHeightDoubleWideProfile":  true,
                                             "uuid":  null,
                                             "powerAllocationWatts":  null,
                                             "serialConsole":  null
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  6,
                                             "model":  null,
                                             "devicePresence":  "Absent",
                                             "profileUri":  null,
                                             "deviceUri":  null,
                                             "coveredByProfile":  null,
                                             "coveredByDevice":  null,
                                             "ipv4Setting":  null,
                                             "ipv6Setting":  null,
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/6",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  true,
                                             "availableForFullHeightProfile":  true,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "Empty",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  false,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  null,
                                             "serialConsole":  null
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  7,
                                             "model":  null,
                                             "devicePresence":  "Absent",
                                             "profileUri":  null,
                                             "deviceUri":  null,
                                             "coveredByProfile":  null,
                                             "coveredByDevice":  null,
                                             "ipv4Setting":  null,
                                             "ipv6Setting":  null,
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/7",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  true,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "Empty",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  true,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  null,
                                             "serialConsole":  null
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  8,
                                             "model":  null,
                                             "devicePresence":  "Absent",
                                             "profileUri":  null,
                                             "deviceUri":  null,
                                             "coveredByProfile":  null,
                                             "coveredByDevice":  null,
                                             "ipv4Setting":  null,
                                             "ipv6Setting":  null,
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/8",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  true,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "Empty",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  false,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  null,
                                             "serialConsole":  null
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  9,
                                             "model":  null,
                                             "devicePresence":  "Absent",
                                             "profileUri":  null,
                                             "deviceUri":  null,
                                             "coveredByProfile":  null,
                                             "coveredByDevice":  null,
                                             "ipv4Setting":  null,
                                             "ipv6Setting":  null,
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/9",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  true,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "Empty",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  true,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  null,
                                             "serialConsole":  null
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  10,
                                             "model":  null,
                                             "devicePresence":  "Absent",
                                             "profileUri":  null,
                                             "deviceUri":  null,
                                             "coveredByProfile":  null,
                                             "coveredByDevice":  null,
                                             "ipv4Setting":  null,
                                             "ipv6Setting":  null,
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/10",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  true,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "Empty",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  false,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  null,
                                             "serialConsole":  null
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  11,
                                             "model":  null,
                                             "devicePresence":  "Absent",
                                             "profileUri":  null,
                                             "deviceUri":  null,
                                             "coveredByProfile":  null,
                                             "coveredByDevice":  null,
                                             "ipv4Setting":  null,
                                             "ipv6Setting":  null,
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/11",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  true,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "Empty",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  true,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  null,
                                             "serialConsole":  null
                                         },
                                         {
                                             "type":  "DeviceBayV8",
                                             "bayNumber":  12,
                                             "model":  null,
                                             "devicePresence":  "Absent",
                                             "profileUri":  null,
                                             "deviceUri":  null,
                                             "coveredByProfile":  null,
                                             "coveredByDevice":  null,
                                             "ipv4Setting":  null,
                                             "ipv6Setting":  null,
                                             "uri":  "/rest/enclosures/P06011CNX240004M/device-bays/12",
                                             "category":  "device-bays",
                                             "eTag":  null,
                                             "created":  null,
                                             "modified":  null,
                                             "availableForHalfHeightProfile":  true,
                                             "availableForFullHeightProfile":  false,
                                             "deviceBayType":  "SY12000DeviceBay",
                                             "deviceFormFactor":  "Empty",
                                             "bayPowerState":  "Unknown",
                                             "changeState":  "None",
                                             "availableForHalfHeightDoubleWideProfile":  false,
                                             "availableForFullHeightDoubleWideProfile":  false,
                                             "uuid":  null,
                                             "powerAllocationWatts":  null,
                                             "serialConsole":  null
                                         }
                                     ],
                      "interconnectBayCount":  6,
                      "interconnectBays":  [
                                               {
                                                   "bayNumber":  1,
                                                   "interconnectUri":  null,
                                                   "logicalInterconnectUri":  null,
                                                   "interconnectModel":  null,
                                                   "ipv4Setting":  null,
                                                   "ipv6Setting":  null,
                                                   "serialNumber":  null,
                                                   "interconnectBayType":  "SY12000InterconnectBay",
                                                   "changeState":  "None",
                                                   "bayPowerState":  "Unknown",
                                                   "powerAllocationWatts":  null,
                                                   "serialConsole":  null
                                               },
                                               {
                                                   "bayNumber":  2,
                                                   "interconnectUri":  "/rest/interconnects/692ec491-edfe-4b40-8d16-51bb7d3b9818",
                                                   "logicalInterconnectUri":  null,
                                                   "interconnectModel":  "Brocade 32Gb/20 FC Switch Module Pwr Pk for Synergy",
                                                   "ipv4Setting":  {
                                                                       "ipAddress":  "172.16.174.187",
                                                                       "mode":  "Manual",
                                                                       "ipAssignmentState":  "Assigned",
                                                                       "ipRangeUri":  null
                                                                   },
                                                   "ipv6Setting":  {
                                                                       "ipAddress":  null,
                                                                       "mode":  "External",
                                                                       "ipAssignmentState":  "None",
                                                                       "ipRangeUri":  null
                                                                   },
                                                   "serialNumber":  "VNK226R014",
                                                   "interconnectBayType":  "SY12000InterconnectBay",
                                                   "changeState":  "None",
                                                   "bayPowerState":  "Unknown",
                                                   "powerAllocationWatts":  70,
                                                   "serialConsole":  true,
                                                   "partNumber":  "Q2E57A"
                                               },
                                               {
                                                   "bayNumber":  3,
                                                   "interconnectUri":  "/rest/interconnects/59f1ee99-92cd-46e8-8f07-7697fbe445fc",
                                                   "logicalInterconnectUri":  "/rest/logical-interconnects/71ac6dfe-1442-4e8d-aeb2-ea84538bf99f",
                                                   "interconnectModel":  "Virtual Connect SE 100Gb F32 Module for Synergy",
                                                   "ipv4Setting":  {
                                                                       "ipAddress":  "172.16.174.188",
                                                                       "mode":  "Manual",
                                                                       "ipAssignmentState":  "Assigned",
                                                                       "ipRangeUri":  null
                                                                   },
                                                   "ipv6Setting":  {
                                                                       "ipAddress":  null,
                                                                       "mode":  "External",
                                                                       "ipAssignmentState":  "None",
                                                                       "ipRangeUri":  null
                                                                   },
                                                   "serialNumber":  "7C9M3300CJ",
                                                   "interconnectBayType":  "SY12000InterconnectBay",
                                                   "changeState":  "None",
                                                   "bayPowerState":  "Unknown",
                                                   "powerAllocationWatts":  270,
                                                   "serialConsole":  true,
                                                   "partNumber":  "867796-B21"
                                               },
                                               {
                                                   "bayNumber":  4,
                                                   "interconnectUri":  null,
                                                   "logicalInterconnectUri":  null,
                                                   "interconnectModel":  null,
                                                   "ipv4Setting":  null,
                                                   "ipv6Setting":  null,
                                                   "serialNumber":  null,
                                                   "interconnectBayType":  "SY12000InterconnectBay",
                                                   "changeState":  "None",
                                                   "bayPowerState":  "Unknown",
                                                   "powerAllocationWatts":  null,
                                                   "serialConsole":  null
                                               },
                                               {
                                                   "bayNumber":  5,
                                                   "interconnectUri":  "/rest/interconnects/64b8f487-9630-48a6-ab23-3ae18fe93f08",
                                                   "logicalInterconnectUri":  null,
                                                   "interconnectModel":  "Brocade 32Gb/20 FC Switch Module Pwr Pk for Synergy",
                                                   "ipv4Setting":  {
                                                                       "ipAddress":  "172.16.174.189",
                                                                       "mode":  "Manual",
                                                                       "ipAssignmentState":  "Assigned",
                                                                       "ipRangeUri":  null
                                                                   },
                                                   "ipv6Setting":  {
                                                                       "ipAddress":  null,
                                                                       "mode":  "External",
                                                                       "ipAssignmentState":  "None",
                                                                       "ipRangeUri":  null
                                                                   },
                                                   "serialNumber":  "VNK226R00N",
                                                   "interconnectBayType":  "SY12000InterconnectBay",
                                                   "changeState":  "None",
                                                   "bayPowerState":  "Unknown",
                                                   "powerAllocationWatts":  70,
                                                   "serialConsole":  true,
                                                   "partNumber":  "Q2E57A"
                                               },
                                               {
                                                   "bayNumber":  6,
                                                   "interconnectUri":  "/rest/interconnects/9afe82e7-caa8-4419-a2db-f317e93634a9",
                                                   "logicalInterconnectUri":  "/rest/logical-interconnects/72bfcae2-fda3-4538-82c1-10d781caae42",
                                                   "interconnectModel":  "Virtual Connect SE 100Gb F32 Module for Synergy",
                                                   "ipv4Setting":  {
                                                                       "ipAddress":  "172.16.174.190",
                                                                       "mode":  "Manual",
                                                                       "ipAssignmentState":  "Assigned",
                                                                       "ipRangeUri":  null
                                                                   },
                                                   "ipv6Setting":  {
                                                                       "ipAddress":  null,
                                                                       "mode":  "External",
                                                                       "ipAssignmentState":  "None",
                                                                       "ipRangeUri":  null
                                                                   },
                                                   "serialNumber":  "7C9M3300CP",
                                                   "interconnectBayType":  "SY12000InterconnectBay",
                                                   "changeState":  "None",
                                                   "bayPowerState":  "Unknown",
                                                   "powerAllocationWatts":  270,
                                                   "serialConsole":  true,
                                                   "partNumber":  "867796-B21"
                                               }
                                           ],
                      "fanBayCount":  10,
                      "fanBays":  [
                                      {
                                          "bayNumber":  1,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB032L"
                                      },
                                      {
                                          "bayNumber":  2,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB032K"
                                      },
                                      {
                                          "bayNumber":  3,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB032J"
                                      },
                                      {
                                          "bayNumber":  4,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB02NN"
                                      },
                                      {
                                          "bayNumber":  5,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB04MQ"
                                      },
                                      {
                                          "bayNumber":  6,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB032I"
                                      },
                                      {
                                          "bayNumber":  7,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB02ML"
                                      },
                                      {
                                          "bayNumber":  8,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB046L"
                                      },
                                      {
                                          "bayNumber":  9,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB02KD"
                                      },
                                      {
                                          "bayNumber":  10,
                                          "devicePresence":  "Present",
                                          "deviceRequired":  true,
                                          "status":  "OK",
                                          "model":  "Synergy Fan Module",
                                          "partNumber":  "809097-001",
                                          "sparePartNumber":  "807967-001",
                                          "fanBayType":  "SY12000FanBay",
                                          "changeState":  "None",
                                          "serialNumber":  "SU21BB02OU"
                                      }
                                  ],
                      "powerSupplyBayCount":  6,
                      "powerSupplyBays":  [
                                              {
                                                  "bayNumber":  1,
                                                  "devicePresence":  "Present",
                                                  "status":  "OK",
                                                  "model":  "2650W AC Titanium Hot Plug Power Supply",
                                                  "serialNumber":  "9C4237089P",
                                                  "partNumber":  "798095-B21",
                                                  "sparePartNumber":  "813829-001",
                                                  "powerSupplyBayType":  "SY12000PowerSupplyBay",
                                                  "changeState":  "None",
                                                  "outputCapacityWatts":  2650
                                              },
                                              {
                                                  "bayNumber":  2,
                                                  "devicePresence":  "Present",
                                                  "status":  "OK",
                                                  "model":  "2650W AC Titanium Hot Plug Power Supply",
                                                  "serialNumber":  "9C423707KD",
                                                  "partNumber":  "798095-B21",
                                                  "sparePartNumber":  "813829-001",
                                                  "powerSupplyBayType":  "SY12000PowerSupplyBay",
                                                  "changeState":  "None",
                                                  "outputCapacityWatts":  2650
                                              },
                                              {
                                                  "bayNumber":  3,
                                                  "devicePresence":  "Present",
                                                  "status":  "OK",
                                                  "model":  "2650W AC Titanium Hot Plug Power Supply",
                                                  "serialNumber":  "9C423707XG",
                                                  "partNumber":  "798095-B21",
                                                  "sparePartNumber":  "813829-001",
                                                  "powerSupplyBayType":  "SY12000PowerSupplyBay",
                                                  "changeState":  "None",
                                                  "outputCapacityWatts":  2650
                                              },
                                              {
                                                  "bayNumber":  4,
                                                  "devicePresence":  "Present",
                                                  "status":  "OK",
                                                  "model":  "2650W AC Titanium Hot Plug Power Supply",
                                                  "serialNumber":  "9C423707L2",
                                                  "partNumber":  "798095-B21",
                                                  "sparePartNumber":  "813829-001",
                                                  "powerSupplyBayType":  "SY12000PowerSupplyBay",
                                                  "changeState":  "None",
                                                  "outputCapacityWatts":  2650
                                              },
                                              {
                                                  "bayNumber":  5,
                                                  "devicePresence":  "Present",
                                                  "status":  "OK",
                                                  "model":  "2650W AC Titanium Hot Plug Power Supply",
                                                  "serialNumber":  "9C423707M4",
                                                  "partNumber":  "798095-B21",
                                                  "sparePartNumber":  "813829-001",
                                                  "powerSupplyBayType":  "SY12000PowerSupplyBay",
                                                  "changeState":  "None",
                                                  "outputCapacityWatts":  2650
                                              },
                                              {
                                                  "bayNumber":  6,
                                                  "devicePresence":  "Present",
                                                  "status":  "OK",
                                                  "model":  "2650W AC Titanium Hot Plug Power Supply",
                                                  "serialNumber":  "9C4237086C",
                                                  "partNumber":  "798095-B21",
                                                  "sparePartNumber":  "813829-001",
                                                  "powerSupplyBayType":  "SY12000PowerSupplyBay",
                                                  "changeState":  "None",
                                                  "outputCapacityWatts":  2650
                                              }
                                          ],
                      "enclosureGroupUri":  "/rest/enclosure-groups/d1c008bb-3f54-458a-8029-9da8c801841b",
                      "fwBaselineUri":  "",
                      "fwBaselineName":  "",
                      "isFwManaged":  false,
                      "forceInstallFirmware":  false,
                      "logicalEnclosureUri":  "/rest/logical-enclosures/f6e77cff-9d05-4f99-8719-2a6f1f3be856",
                      "managerBays":  [
                                          {
                                              "bayNumber":  1,
                                              "managerType":  "EnclosureManager",
                                              "uidState":  "Off",
                                              "bayPowerState":  "Unknown",
                                              "fwVersion":  "3.03.01",
                                              "devicePresence":  "Present",
                                              "role":  "Active",
                                              "ipAddress":  "fe80::5eba:2cff:fe51:52f0",
                                              "changeState":  "None",
                                              "fwBuildDate":  "06/23/2021,15:36:45",
                                              "serialNumber":  "CN7235W0LS",
                                              "status":  "OK",
                                              "sparePartNumber":  "P04749-001",
                                              "partNumber":  "876852-B21",
                                              "mgmtPortLinkState":  "Linked",
                                              "linkPortState":  "Linked",
                                              "mgmtPortStatus":  "OK",
                                              "linkPortStatus":  "OK",
                                              "negotiatedMgmtPortSpeedGbs":  1,
                                              "negotiatedLinkPortSpeedGbs":  10,
                                              "linkPortIsolated":  true,
                                              "mgmtPortState":  "Standby",
                                              "mgmtPortNeighbor":  {
                                                                       "macAddress":  "6C:AB:05:C5:A4:DA",
                                                                       "port":  "Ethernet1/1",
                                                                       "ipAddress":  null,
                                                                       "resourceUri":  null,
                                                                       "description":  "Cisco Nexus Operating System (NX-OS) Software 9.3(8)\nTAC support: http://www.cisco.com/tac\nCopyright (c) 2002-2021, Cisco Systems, Inc. All rights reserved.CNEXCNRHDR2.subd01.customer.com"
                                                                   },
                                              "mgmtPortSpeedGbs":  "10",
                                              "linkPortSpeedGbs":  "10",
                                              "model":  "HPE Synergy 4-port Frame Link Module",
                                              "appliancePort1State":  "Enabled",
                                              "appliancePort1Status":  "OK",
                                              "appliancePort1SpeedGbs":  10,
                                              "appliancePort2State":  "Enabled",
                                              "appliancePort2Status":  "OK",
                                              "appliancePort2SpeedGbs":  10,
                                              "linkedEnclosure":  {
                                                                      "bayNumber":  2,
                                                                      "serialNumber":  "CNX240004M"
                                                                  }
                                          },
                                          {
                                              "bayNumber":  2,
                                              "managerType":  "EnclosureManager",
                                              "uidState":  "Off",
                                              "bayPowerState":  "Unknown",
                                              "fwVersion":  "3.03.01",
                                              "devicePresence":  "Present",
                                              "role":  "Standby",
                                              "ipAddress":  "fe80::5eba:2cff:fe51:92c8",
                                              "changeState":  "None",
                                              "fwBuildDate":  "06/23/2021,15:36:45",
                                              "serialNumber":  "CN7235W0RW",
                                              "status":  "OK",
                                              "sparePartNumber":  "P04749-001",
                                              "partNumber":  "876852-B21",
                                              "mgmtPortLinkState":  "Linked",
                                              "linkPortState":  "Linked",
                                              "mgmtPortStatus":  "OK",
                                              "linkPortStatus":  "OK",
                                              "negotiatedMgmtPortSpeedGbs":  1,
                                              "negotiatedLinkPortSpeedGbs":  10,
                                              "linkPortIsolated":  false,
                                              "mgmtPortState":  "Active",
                                              "mgmtPortNeighbor":  {
                                                                       "macAddress":  "6C:AB:05:C5:A4:DB",
                                                                       "port":  "Ethernet1/2",
                                                                       "ipAddress":  null,
                                                                       "resourceUri":  null,
                                                                       "description":  "Cisco Nexus Operating System (NX-OS) Software 9.3(8)\nTAC support: http://www.cisco.com/tac\nCopyright (c) 2002-2021, Cisco Systems, Inc. All rights reserved.CNEXCNRHDR2.subd01.customer.com"
                                                                   },
                                              "mgmtPortSpeedGbs":  "10",
                                              "linkPortSpeedGbs":  "10",
                                              "model":  "HPE Synergy 4-port Frame Link Module",
                                              "appliancePort1State":  "Enabled",
                                              "appliancePort1Status":  "OK",
                                              "appliancePort1SpeedGbs":  10,
                                              "appliancePort2State":  "Enabled",
                                              "appliancePort2Status":  "OK",
                                              "appliancePort2SpeedGbs":  10,
                                              "linkedEnclosure":  {
                                                                      "bayNumber":  1,
                                                                      "serialNumber":  "CNX240004M"
                                                                  }
                                          }
                                      ],
                      "supportState":  "Enabled",
                      "supportDataCollectionState":  null,
                      "supportDataCollectionType":  null,
                      "supportDataCollectionsUri":  "/rest/support/data-collections?deviceID=P06011CNX240004M\u0026category=enclosures",
                      "remoteSupportUri":  "/rest/support/enclosures/P06011CNX240004M",
                      "remoteSupportSettings":  {
                                                    "remoteSupportCurrentState":  "Unknown",
                                                    "destination":  ""
                                                },
                      "crossBars":  [

                                    ],
                      "partitions":  [

                                     ],
                      "scopesUri":  "/rest/scopes/resources/rest/enclosures/P06011CNX240004M",
                      "status":  "OK",
                      "name":  "0MSYN02",
                      "state":  "Configured",
                      "description":  null,
                      "frameLinkModuleDomain":  "local",
                      "applianceBays":  [
                                            {
                                                "bayNumber":  1,
                                                "model":  "Synergy Composer2",
                                                "devicePresence":  "Present",
                                                "status":  "OK",
                                                "serialNumber":  "CNX14000RJ",
                                                "partNumber":  "872957-B21",
                                                "sparePartNumber":  "879540-001",
                                                "bayPowerState":  "Unknown",
                                                "poweredOn":  true
                                            },
                                            {
                                                "bayNumber":  2,
                                                "model":  null,
                                                "devicePresence":  "Absent",
                                                "status":  null,
                                                "serialNumber":  null,
                                                "partNumber":  null,
                                                "sparePartNumber":  null,
                                                "bayPowerState":  "Unknown",
                                                "poweredOn":  false
                                            }
                                        ],
                      "applianceBayCount":  2,
                      "version":  "G1",
                      "powerMode":  "RedundantPowerFeed",
                      "managerBayCount":  2,
                      "fansAndManagementDevicesWatts":  660,
                      "powerCapacityBoostWatts":  872,
                      "minimumPowerSupplies":  1,
                      "minimumPowerSuppliesForRedundantPowerFeed":  2,
                      "powerAvailableWatts":  5650,
                      "powerCapacityWatts":  7950,
                      "deviceBayWatts":  1832,
                      "interconnectBayWatts":  680,
                      "powerAllocatedWatts":  3172,
                      "ApplianceConnection":  {
                                                  "Name":  "0msyn02.subd01.customer.com",
                                                  "ConnectionId":  2
                                              }
                  },
    "BayNumber":  1,
    "IsExtAccessible":  true,
    "IloConfig":  {
                      "Supported":  true,
                      "Username":  "",
                      "Password":  null,
                      "Hostname":  "",
                      "IPv4Config":  null,
                      "IPv6Config":  null
                  },
    "Uri":  "/rest/hw-appliances/CNX14000RJ",
    "ApplianceConnection":  {
                                "Name":  "0msyn02.subd01.customer.com",
                                "ConnectionId":  2
                            }
}
PS C:\Users\>
olant commented 1 year ago

The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values Sure, some elemets are NULL, but that is expected.

ChrisLynchHPE commented 1 year ago

The reference to null in the message does not indicate the property values. There is a specific object in the variable that is null for some reason. For instance, I was expecting a null array element in the JSON conversion, like this:

[
    {
        "Name": "0MSYN02, appliance bay 1",
        "ID": "CNX14000RJ",
        "Model": "SynergyComposer2",
        "Role": 0,
        "Version": {
            "BuildVersion": null,
            "MajorVersion": "6",
            "MinorVersion": 60,
            "PatchVersion": 2,
            "PrereleaseVersion": "0467825"
        },
        "Enclosure": {
            "DATA_REMOVED_FOR_SIMPLICATION"
        },
        "BayNumber": 1,
        "IsExtAccessible": true,
        "IloConfig": {
            "Supported": true,
            "Username": "",
            "Password": null,
            "Hostname": "",
            "IPv4Config": null,
            "IPv6Config": null
        },
        "Uri": "/rest/hw-appliances/CNX14000RJ",
        "ApplianceConnection": {
            "Name": "0msyn02.subd01.customer.com",
            "ConnectionId": 2
        }
    },
    // This is the empty or null element that I was expecting to see.
    {}
]

Let me look into this further, but I'm struggling to figure out why this is happening.

ChrisLynchHPE commented 1 year ago

The issue isn't within the -InputObject parameter validation for Enable-OVComposerIlo. Rather, there is an empty variable being returned to the pipeline within Get-OVComposerIloStatus. To validate this, I would expect 2 to be returned when you executed:

[Array]$ComposerAppliance.Count

Now, do this, and I would expect 1 to be returned

($ComposerAppliance. Where({ $_ -ne $null })).Count

You can use the .Where() method to work around this issue until I release an updated library addressing this specific issue. BTW, this is present in all library releases, including up to the current 8.0 release.

ChrisLynchHPE commented 1 year ago

This issue is resolved in both the 7.20 and 8.00 libraries:

I will be posting updates to the 6.60, 7.00 and 7.10 libraries later in the week.