HewlettPackard / POSH-HPEOneView

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

New-HPOVUplinkSet - Exception calling "Join" with "2" argument(s): "Value cannot be null. #243

Closed scriptengine closed 7 years ago

scriptengine commented 7 years ago

Expected Behavior

Commands to run with out internal errors / When insufficient or invalid parameter sets are supplied for the command to error gracefully.

Actual Behavior

New-HPOVUplinkSet throws an error with the parameter combination below

PS> Get-HPOVLogicalInterconnectGroup -name LIG-MLAG | New-HPOVUplinkSet -Name "Internal" -Type Ethernet -Networks Internal Exception calling "Join" with "2" argument(s): "Value cannot be null. Parameter name: values" At C:\Program Files\WindowsPowerShell\Modules\HPOneView.300\HPOneView.300.psm1:54205 char:6

The command actually runs after the error.

Steps to reproduce

use New-HPOVUplinkSet with just -name , -type and -Networks

Question

I got into this mess as I was trying to find a way to add an Internal network (New-HPOVNetwork -Name Internal -privateNetwork $True ... ) To the Internal "uplink" that exists in the OV GUI I can add the "Internal" network to the "Internal" uplink in the GUI and are wondering how I do it from PS. Picture attached internal

Version Information

3.0.1210.3013

ChrisLynchHPE commented 7 years ago

The Internal Networks are tied to either the Logical Interconnect Group or Logical Interconnect resource, not an Uplink Set. So you would add the network using the -InternalNetworks parameter when creating a Logical Interconnect Group. You are trying to create an Uplink Set without Uplink Ports, which is what inadvertently the exception is being triggered. So, I'll look at handle the case where a caller doesn't provide -UplinkPorts parameter, but that's not how you define Internal Networks for a LIG or LI.

ChrisLynchHPE commented 7 years ago

This is fixed in Release 3.0.1264.2772.

ChrisLynchHPE commented 7 years ago

closing.

Sergong commented 4 years ago

Hi, I know this is an old and now closed issue but there doesn't seem to be a way to modify Internal networks once you have created a Logical Interconnect Group and used the -InternalNetworks parameter. There doesn't seem to be a Set-LogicalInterconnectGroup commandlet that would allow you to do that. Is there any other way this can be achieved?

Thanks!

ChrisLynchHPE commented 4 years ago

Yes. There is an internalNetworkUris property, which is an array of URI's. For instance, if you wanted to remove an Internal Network from a specific LIG you would do the following:

# Get the network object to remove
$NetworkToRemove = Get-HPOVNetwork -Name "Net to remove"

# Get the LIG to modify
$Lig = Get-HPOVLogicalInterconnectGroup -Name "Lig to modify"

# Exclude the network to remove by comparing the existing collection of Uris to the network to remove's Uri
$lig.internalNetworkUris = $Lig.internalNetworkUris | ? { $_ -ne $NetworkToRemove.uri }

# Save the resource
Set-HPOVResource -InputObject $Lig

If you wanted to add a new network to this property, do the following:

# Get the network object to add
$NetworkToAdd = Get-HPOVNetwork -Name "Net to remove"

# Get the LIG to modify
$Lig = Get-HPOVLogicalInterconnectGroup -Name "Lig to modify"

# Add the new network's Uri to the array
$lig.internalNetworkUris += $NetworkToAdd .uri

# Save the resource
Set-HPOVResource -InputObject $Lig
Sergong commented 4 years ago

Hi @ChrisLynchHPE, That is great, thank you very much! This is much appreciated!