UCS PowerTool and Instant Gratification

Version 3

    Integrating software with infrastructure components can be an onerous and time-consuming effort.  It often involves late night searches for  documentation and code examples, fueled by copious amounts of caffeine.   More often, client code must be refactored, recompiled and redeployed  because of missing data or unexpected results from the targeted system.  This integration pain can be eased (and surprises avoided) by  integrating early and using robust client  libraries.  Ideally, integrators could issue commands that target infrastructure in the same way  that a Windows user issues commands in a DOS shell.  This ease of integration with UCS can be realized by using the UCS PowerTool library.

     

    With UCS PowerTool, integrators can get "instant-gratification" by issuing query and configuration cmdlets through the PowerTool command-line. These commands can be grouped in a transaction and can target one, or many UCS domains - even if the target domains are running different versions of UCS software.  For more compicated operations, commands can be called from a PowerShell script.   Alas, the purpose of this article is not to describe the virtues of UCS PowerTool, but, to get you to experience it for yourself.

     

    Perhaps the best way to get started with PowerShell is by using it to perform a common administrative task.    The example I will use is to generate a multi UCS domain identity (wwn, uuid, ip, iqn) report.  This script requires only a hand-full of PowerTool cmdlets to produce a useful report (and it was demonstrated it at Cisco Live 2013).

     

    Our first step is to connect to multiple UCS domains.  We just have to remember to set the "SupportMultipeDefaultUcs" flag.

         Set-UcsPowerToolConfiguration -SupportMultiplDefaultUcs $true
         Connect-Ucs 10.29.141.18
         Connect-Ucs 10.29.141.21
         Get-UcsPSSession
    

    We can query any of the identities based on their UCS class name.  We can format them to extract the fields we wish to view.

         Get-UcsMacPoolAddr | Format-Table  ucs,id,assigned,owner,assignedToDn
         Get-UcsUuidPoolAddr  | Format-Table ucs,id,assigned,owner,assignedToDn
         Get-UcsFcPoolAddr  | Format-Table ucs,id,assigned,owner,assignedToDn
         Get-UcsIpPoolAddr  | Format-Table ucs,id,assigned,owner,assignedToDn
            Get-UcsIqnPoolAddr  | Format-Table ucs,name,assigned,owner,assignedToDn
    

    The following cmdlets can be used to identify duplicate identities.  The same approach could be used for each type of identity.

         $lMacs Get-UcsMacPoolAddr | Format-Table  ucs,id,assigned,owner,assignedToDn
            $lMacs | Group-Object {$_.id} | Where-Object {$_.count -gt 1 } | select -ExpandProperty Group |  select Ucs,Id,assigned,assignedToDn | sort-object id
    

    Now, we have all the information that we need from UCS.  Next, we can use embed them in a PowerShell script and format the results in a report.  Here is a simple example of a IdentityReportPowerShell script that produced the following Report.

     

    Although this is a basic example. it illustrates the ease of extracting mult-domain UCS configuration information.

     

    A more involved example of harvesting identity information for multiple UCS domains can be found here:  MigrateIdentity.

     

    Enjoy

     

    Ike