HewlettPackard / POSH-HPEOneView

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

Create ServerProfileTemplate with connections with unnasigned network works, but return an error #640

Closed XavierL10 closed 1 year ago

XavierL10 commented 1 year ago

Hello,

When I trying to create a ServerProfileTemplate with list of connections where some connections have unassigned network (Connection has been previously created using the fonction New-OVServerProfileConnection with key work Unnasigned for network), the ServerProfileTemplate is created, but during the execution of the function, error messages are returned : You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\HPEOneView.600\6.0.2785.2604\HPEOneView.600.psm1:109235 char:26

You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\HPEOneView.600\6.0.2785.2604\HPEOneView.600.psm1:109235 char:26

Connections list used as parameter for ServerProfileConnection (in JSON format) : { "id": 1, "functionType": "Ethernet", "name": "LAN_Prod_1", "portId": "Mezz 3:1-a", "networkUri": "/rest/network-sets/73dc2e23-be5c-4bcb-8c59-3f6285577f7d", "requestedMbps": 2500, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": "LAG1", "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 2, "functionType": "Ethernet", "name": "LAN_Prod_2", "portId": "Mezz 3:2-a", "networkUri": "/rest/network-sets/73dc2e23-be5c-4bcb-8c59-3f6285577f7d", "requestedMbps": 2500, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": "LAG1", "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 3, "functionType": "FibreChannel", "name": "SAN_1", "portId": "Mezz 3:1-b", "networkUri": "/rest/fc-networks/f459d512-553a-4e31-98b1-bdeb42176e23", "requestedMbps": "2500", "boot": null, "macType": "Virtual", "mac": null, "wwpnType": "Virtual", "wwnn": null, "wwpn": null, "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 4, "functionType": "FibreChannel", "name": "SAN_2", "portId": "Mezz 3:2-b", "networkUri": "/rest/fc-networks/2fcf1119-47c4-4f28-8312-6b2f01eb0958", "requestedMbps": "2500", "boot": null, "macType": "Virtual", "mac": null, "wwpnType": "Virtual", "wwnn": null, "wwpn": null, "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 5, "functionType": "Ethernet", "name": "LAN_Backup_1", "portId": "Mezz 3:1-d", "networkUri": "/rest/network-sets/d9ce4afb-f595-4e70-9561-2cdc6171444e", "requestedMbps": 3000, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": null, "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 6, "functionType": "Ethernet", "name": "LAN_Backup_2", "portId": "Mezz 3:2-d", "networkUri": "/rest/network-sets/d9ce4afb-f595-4e70-9561-2cdc6171444e", "requestedMbps": 3000, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": null, "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 7, "functionType": "Ethernet", "name": "LAN_Tenant1_1", "portId": "Mezz 3:1-e", "networkUri": "/rest/network-sets/6810f21f-22c8-4ae4-88fb-38f0f350df76", "requestedMbps": 2500, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": "LAG3", "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 8, "functionType": "Ethernet", "name": "LAN_Tenant1_2", "portId": "Mezz 3:2-e", "networkUri": "/rest/network-sets/6810f21f-22c8-4ae4-88fb-38f0f350df76", "requestedMbps": 2500, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": "LAG3", "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 9, "functionType": "Ethernet", "name": "LAN_Tenant2_1", "portId": "Mezz 3:1-f", "networkUri": "/rest/network-sets/e8097ac8-d2bc-4c0a-8174-d2ab8171f946", "requestedMbps": 5000, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": "LAG4", "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1 } }, { "id": 10, "functionType": "Ethernet", "name": "LAN_Tenant2_2", "portId": "Mezz 3:2-f", "networkUri": "/rest/network-sets/e8097ac8-d2bc-4c0a-8174-d2ab8171f946", "requestedMbps": 5000, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": "LAG4", "ApplianceConnection": { "Name": "192.168.199.32", "ConnectionId": 1
} }, {
"id": 11,
"functionType": "Ethernet", "name": "LAN_Tenant_Empty_1", "portId": "Mezz 3:1-g", "networkUri": null, "requestedMbps": 0, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": "LAG6", "ApplianceConnection": null }, { "id": 12, "functionType": "Ethernet", "name": "Lan_Tenant_Empty_2", "portId": "Mezz 3:2-g", "networkUri": null, "requestedMbps": 0, "boot": null, "macType": "Virtual", "mac": null, "requestedVFs": "0", "lagName": "LAG6", "ApplianceConnection": null } ]

As there is some errors returned, if we insert the function in try/catch, the execution will failed and catch the errors, and ServerProfileTemplate will be not created.

My script is currently working, but without try/catch for ServerProfileTemplate creation, which is annoying to manage errors on script execution.

Steps to reproduce

Create connections using function New-OVServerProfileConnection with Key word "Unassigned" to parameter Network

Use the previous connections created with function New-OVServerProfileTemplate, on parameter Connections

# 1. Capture verbose output using the Get-HPOVCommandTrace for HPOneView.310 or newer, or append the -Verbose switch to your Cmdlet call.
# 2. Put your code and/or captured output here.
# 3. Remove this comment block before submitting.

Version Information

HPE OneView PowerShell Library Version (Get-HPOVVersion or $PSLibraryVersion): 6.10 HPE OneView Appliance Version (Get-HPOVVersion -ApplianceVer): 8.10 Output from $PSVersionTable on your Windows Host: Name Value


PSVersion 5.1.19041.2673 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.2673 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

# Output from $PSVersionTable

Thank a lot for your help.

VincentBerger commented 1 year ago

You're using a pretty old version of the library (6.10), you should upgrade to something more recent, especially since you're using a recent appliance version (8.10). This issue in particular (fixed in 6.30) could be a match for your issue.

XavierL10 commented 1 year ago

With the version HPEOneView.800, it works perfectly. Thank for your help.