Subscribe
Accepted Solution

Unable to create vlan using cmode DataONTAP powershell cmdelts in WFA

I am trying to create vlan in cmode using WFA, but getting error like Parameter set cannot be resolved using the specified named parameters.

 

 

Trying to execute below script:

 

$PWord = ConvertTo-SecureString –String $password –AsPlainText -Force
$credential=New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $username, $PWord

$obj = Connect-NcController $Cluster -Credential $credential

New-NcNetPortVlan -VlanName "e0c-22" -Node "Rcluster-01" -ParentInterface e0c -VlanID 22 -Controller $obj

 

What can be the issue ? Any inputs would be helpful

Re: Unable to create vlan using cmode DataONTAP powershell cmdelts in WFA

I've been using a different set of a parameters for the 'New-NcNetPortVlan' and it works pretty well.  This is the code I've been using in a custom command  to create VLANs; maybe give it a try?

 

param (
  [parameter(Mandatory=$true, HelpMessage="Cluster IP Address")]
  [string]$Cluster,

  [parameter(Mandatory=$true, HelpMessage="Node name")]
  [string]$Node,

  [parameter(Mandatory=$true, HelpMessage="Port/IFGRP name")]
  [string]$Port,

  [parameter(Mandatory=$true, HelpMessage="VLAN ID")]
  [Alias("Vlan ID")]
  [int]$VLANID
)

# connect to controller
Connect-WfaCluster $Cluster

# create the VLAN
Get-WFALogger -Info -message $("Creating VLAN: '"+ $VLANID + "' on port/ifgrp '" + $Port + "' on Node '" + $Node + "' on Cluster '" + $Cluster + "'")
New-NcNetPortVlan $Port -Node $Node -VlanId $VLANID  -ErrorAction Stop

Re: Unable to create vlan using cmode DataONTAP powershell cmdelts in WFA

Hello!

 

I believe you're mixing parameters across the two methods of instantiating a VLAN on a port/ifgrp.  Using one parameter set or the other should fix the error.

 

The first method uses only the "VlanName" parameter to determine which VLAN and port/ifgrp to host it on:

 

New-NcNetPortVlan -Node Rcluster-01 -VlanName e0c-22

 

The second method simply specifies each piece of information individually:

 

New-NcNetPortVlan -Node Rcluster-01 -ParentInterface e0c -VlanId 22

# note that this method is usefull for specifying multiple VLANs simultaneously, e.g.:
New-NcNetPortVlan -Node Rcluster-01 -ParentInterface e0c -VlanId 22,56,109,1402

Because you're supplying information for both PowerShell is unable to determine which parameter set it should be using (even though they behave the same and each has all of it's data).

 

Hope that helps.

 

V/r,

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: Unable to create vlan using cmode DataONTAP powershell cmdelts in WFA

[ Edited ]

Yes this worked. Another issue with this is I want to give user input as Vlan Name which will be in format for ex. a0a-1111. 

 

When I try to execute the below command script in wfa it gives me the error as 

 

VLAN interface names must adhere to the following format: "<port name>-<vlan id>".

 

param (
[parameter(Mandatory=$true, HelpMessage="Name of the Storage VLAN ID.")]
[string]$VlanName,

[parameter(Mandatory=$true, HelpMessage="Name of the Storage Cluster")]
[string]$Cluster,

[parameter(Mandatory=$true, HelpMessage="Name of the Storage Node Name.")]
[string]$NodeName

)

Connect-WfaCluster $Cluster

$vlanname=$VlanName -Split "-"
$vlanname[0]
$vlanname[1]
New-NcNetPortVlan -Node $NodeName -ParentInterface $vlanname[0] -VlanId $vlanname[1]

 

 

But at the same time when I try to execute the last 4 lines of script in powershell It is working successfully. 

 

What can be the issue