cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
813
Views
0
Helpful
1
Replies

PowerShell: How to determine FI ports are already set as uplinks?

rmxyz
Level 1
Level 1

Hi,

As part of our UCS configuration script, we run the following to configure FI ports as uplinks (example):


Add-UcsUplinkPort -AdminState 'enabled' -PortId $PortId -SlotId 1 -FiLanCloud 'A'
 

Before executing this however, I want to check if the port is already configured (perhaps it's been done manually, perhaps we're re-running the script to make sure everything is as it should be).

You'd think it would be as easy as 'Get-UcsUplinkPort' but no, as this doesn't return a ports that are already in use. So, the state could be "in use already" or "not in use" and it still returns $null.

The problem with this is that if 'Add-UcsUplinkPort' is executed against a port that's already in use, it creates an outage; the 'add' operation repeats itself which removes the port from any uplink port channels.

I've combed through the web interface with developer tools enabled, looking at the network requests when viewing the FI configuration to see if I can determine what cmdlet to use but to no avail (this has helped previously with some other issues, along with the ALT+Q ALT+Q recording trick but this is merely getting data, not setting, so the record isn't relevant for this).

Thanks for any help!

 
1 Reply 1

Brian Morrissey
Cisco Employee
Cisco Employee

Get-UcsUplinkPort and Get-UcsUplinkPortChannelMember appear to work in my setup to show the configured ports

Alternatively you could try just querying the managed objects themselves (if you are looking for MO class id's they can be browsed at https://ucsmip/visore.html or in the show-tech there is a dump named mit.xml in the root of the primary FI's show-tech):

PowerTool C:\> get-ucsmanagedobject -ClassId etherPio | Where-Object {($_.IfRole -ne "unknown") -and ($_.IfRole -ne "server")} | Select AdminState,IfRole,Dn,OperSpeed,Operstate | ft

AdminState IfRole Dn OperSpe
ed
---------- ------ -- -------
enabled network sys/switch-A/slot-1/switch-ether/port-17 10gbps
enabled network sys/switch-A/slot-1/switch-ether/port-18 10gbps
enabled network sys/switch-A/slot-1/switch-ether/port-24 10gbps
enabled network sys/switch-A/slot-1/switch-ether/port-31 10gbps
enabled network sys/switch-A/slot-1/switch-ether/port-32 10gbps
enabled network sys/switch-B/slot-1/switch-ether/port-17 10gbps
enabled network sys/switch-B/slot-1/switch-ether/port-18 10gbps
enabled network sys/switch-B/slot-1/switch-ether/port-31 10gbps
enabled network sys/switch-B/slot-1/switch-ether/port-32 10gbps

Review Cisco Networking for a $25 gift card

Review Cisco Networking for a $25 gift card