cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2305
Views
2
Helpful
2
Replies

How to add VLANs to Port Channel members

Charles Morin
Level 4
Level 4

I am trying to use Power tool to add VLANs to Port Channel Members in lieu of using VLAN Manager. Pleaser review the command below as I am getting an error on the VLAN parameter

 

Add-UcsVlanMemberPortChannel -vlan APP_PRD_NLB_2_VLAN090 -PortId 7 -AdminSpeed 10gbps -IsNative no -Name PO207A -SwitchId A

 

 

Add-UcsVlanMemberPortChannel : Cannot bind parameter 'Vlan'. Cannot convert the "APP_PRD_NLB_2_VLAN090" value of type

 

"System.String" to type "Cisco.Ucsm.FabricVlan".

 

At line:1 char:36

 

+ Add-UcsVlanMemberPortChannel -vlan APP_PRD_NLB_2_VLAN090 -PortId 7 -A ...

 

+                                    ~~~~~~~~~~~~~~~~~~~~~

 

    + CategoryInfo          : InvalidArgument: (:) [Add-UcsVlanMemberPortChannel], ParameterBindingException

 

    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Cisco.Ucsm.Cmdlets.AddUcsVlanMemberPortChannel

 

 

Any ideas?

 

1 Accepted Solution

Accepted Solutions

sumbr
Level 4
Level 4

Hi Charles,

You need to pass a FabricVlan object as input to the vlan parameter instead of just the name of the vlan.

You can do something like this

Get-UcsVlan -Name test | Add-UcsVlanMemberPortChannel -PortId 7 -SwitchId A -AdminSpeed 10gbps -IsNative no -Name Test

AdminSpeed : 10gbps

AdminState : enabled

Descr :

EpDn :

IfRole : storage

IfType : aggregation

IsNative : no

Locale : external

Name : Test

OperSpeed : 10gbps

OperState : indeterminate

PeerDn :

PortId : 7

Sacl :

StateQual :

SwitchId : A

Transport : ether

Type : lan

Warnings :

Ucs : savbu-tpi03

Dn : fabric/lan/net-test/pc-switch-A-pc-7

Rn : pc-switch-A-pc-7

Status : created

XtraProperty : {}

Refer online help available for the cmdlet for more details on the parameters.

Get-Help Add-UcsVlanMemberPortChannel

NAME

Add-UcsVlanMemberPortChannel

SYNOPSIS

Adds Managed Object of type FabricEthVlanPc.

   

SYNTAX

Add-UcsVlanMemberPortChannel -FabricNetGroup <FabricNetGroup> [-PortId]

    <uint> [-SwitchId] <string> [-AdminSpeed <string>] [-AdminState <string>]

    [-Descr <string>] [-IsNative <string>] [-Name <string>] [-OperSpeed

    <string>] [-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs

    <UcsHandle[]>] [<CommonParameters>]

    Add-UcsVlanMemberPortChannel -Vlan <FabricVlan> [-PortId] <uint>

    [-SwitchId] <string> [-AdminSpeed <string>] [-AdminState <string>] [-Descr

    <string>] [-IsNative <string>] [-Name <string>] [-OperSpeed <string>]

    [-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs <UcsHandle[]>]

    [<CommonParameters>]

   

DESCRIPTION

Adds Managed Object of type FabricEthVlanPc. Represents an association

    between a VLAN and an Ethernet port channel. This MO is added as a child

    of fabric:Vlan and indicates the specified Ethernet port channel should

    carry the VLAN ID of the parent fabric:Vlan.

Hope this helps. Let us know if you need further assistance on this.


Thanks,

Sumanth

View solution in original post

2 Replies 2

sumbr
Level 4
Level 4

Hi Charles,

You need to pass a FabricVlan object as input to the vlan parameter instead of just the name of the vlan.

You can do something like this

Get-UcsVlan -Name test | Add-UcsVlanMemberPortChannel -PortId 7 -SwitchId A -AdminSpeed 10gbps -IsNative no -Name Test

AdminSpeed : 10gbps

AdminState : enabled

Descr :

EpDn :

IfRole : storage

IfType : aggregation

IsNative : no

Locale : external

Name : Test

OperSpeed : 10gbps

OperState : indeterminate

PeerDn :

PortId : 7

Sacl :

StateQual :

SwitchId : A

Transport : ether

Type : lan

Warnings :

Ucs : savbu-tpi03

Dn : fabric/lan/net-test/pc-switch-A-pc-7

Rn : pc-switch-A-pc-7

Status : created

XtraProperty : {}

Refer online help available for the cmdlet for more details on the parameters.

Get-Help Add-UcsVlanMemberPortChannel

NAME

Add-UcsVlanMemberPortChannel

SYNOPSIS

Adds Managed Object of type FabricEthVlanPc.

   

SYNTAX

Add-UcsVlanMemberPortChannel -FabricNetGroup <FabricNetGroup> [-PortId]

    <uint> [-SwitchId] <string> [-AdminSpeed <string>] [-AdminState <string>]

    [-Descr <string>] [-IsNative <string>] [-Name <string>] [-OperSpeed

    <string>] [-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs

    <UcsHandle[]>] [<CommonParameters>]

    Add-UcsVlanMemberPortChannel -Vlan <FabricVlan> [-PortId] <uint>

    [-SwitchId] <string> [-AdminSpeed <string>] [-AdminState <string>] [-Descr

    <string>] [-IsNative <string>] [-Name <string>] [-OperSpeed <string>]

    [-ModifyPresent] [-XtraProperty <Hashtable>] [-Ucs <UcsHandle[]>]

    [<CommonParameters>]

   

DESCRIPTION

Adds Managed Object of type FabricEthVlanPc. Represents an association

    between a VLAN and an Ethernet port channel. This MO is added as a child

    of fabric:Vlan and indicates the specified Ethernet port channel should

    carry the VLAN ID of the parent fabric:Vlan.

Hope this helps. Let us know if you need further assistance on this.


Thanks,

Sumanth

Thank you Sumanth! This works perfectly. From this I was able to build the following short scripts for assigning VLANs to all the locations required in our environment. Hope this helps others!

$ucs = "ucs"
$vlan_list = import-csv "c:\scripts\ucsvlans.txt"

connect-ucs $ucs

foreach ($vlan in $vlan_list) {
get-ucslancloud | add-ucsvlan -Name $vlan.Name -Id $vlan.Id -DefaultNet "no"
}

$ucs = "ucs"
$vlan_list = import-csv "c:\scripts\ucsvlans_vswitch1.txt"


connect-ucs $ucs

foreach ($vlan in $vlan_list) {
get-ucsvlan -Name $vlan.name  | add-UcsVlanMemberPortChannel -PortId 7 -AdminSpeed 10gbps -IsNative no -Name PO207A -SwitchId A
get-ucsvlan -Name $vlan.name  | add-UcsVlanMemberPortChannel -PortId 8 -AdminSpeed 10gbps -IsNative no -Name PO208B -SwitchId B

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Cisco UCS X-Series Energy Efficiency Offer