Cisco UCS PowerTool Deploy at Scale John McDonough, DevNet Developer Evangelist
Cisco Spark How Questions? Use Cisco Spark to communicate with the speaker after the session 1. Find this session in the Cisco Live Mobile App 2. Click Join the Discussion 3. Install Spark or go directly to the space 4. Enter messages/questions in the space cs.co/ciscolivebot#
Agenda Cisco UCS PowerTool Deploy at Scale UCS Unified API Overview UCS PowerTool Creation / Installation / Get-Help / Parameters UCS Cmdlet Meta Data / Find the Class Id / Cmdlet Noun Connections / Parallelism / -Xml / Transactions / Code Generation Compare & Sync Microsoft DSC / UCS DSC Conclusion
UCS PowerTool Information DevNet UCS Dev Center https://developer.cisco.com/site/ucs-dev-center User Guides Sample Code Learning Labs 5
UCS Platform Emulator (UCSPE) Cisco Communities https://communities.cisco.com/docs/doc-37827 Same Code as UCS Manager Create your own Configurations Import Hardware from Live UCS Import from Live UCS Export 6
Cisco Unified Computing System Cisco UCS Manager / IMC / Central Cisco UCS Fabric Interconnects Cisco UCS I/O modules Cisco UCS Blade Server Chassis Cisco UCS Blade and Rack Servers Cisco UCS I/O Adapters 7
UCS Manager Programmatic Infrastructure Libraries / SDKs GUI & CLI Direct 3 rd Party Customer Self Serve portals Management Tools Auditing Tools XML API Status Inventory Configuration 8
UCS XML API Overview UCS XML API Features Communicates over HTTP / HTTPS XML Based, Transactional Standard Request / Response cycle Role Based Authentication Object Model Hierarchy Built-in Object Browser Published XML Schema Full Object Documentation High Availability by default Event Stream XML API 9
UCSM Object Model Documentation 10
Management Information Model(MIM) Everything is an object Root Objects are hierarchically organized Class identifies object type: Card, Port, VNIC Class Inheritance Server port is a subclass of port. A server blade is a subclass of compute entity. Set of attributes MO represents any physical or logical entity Managed Object Each MO is uniquely identified by DN UCS XML Database contains comprehensive system information Discovered components System configuration Operational status including statistics and faults 11
Distinguished Names dn = {rn 1 }/{rn 2 }/{rn 3 } Example: Root rn 3 rn 1 rn 2 <dn = "sys/chassis-5/blade-2/adaptor-1/host-eth-2"/> is composed of the following relative names: topsystem MO: rn="sys" equipmentchassis MO: rn="chassis-<id>" computeblade MO: rn ="blade-<slotid>" adaptorunit MO: rn="adaptor-<id>" adaptorhostethif MO: rn="host-eth-<id>" Slash delimited sequence of RNs Immutable DN Provides a fully qualified path DN unambiguously identifies a target object. DN name is composed of sequence of Relative Names (RN). RN identifies an object within the context of its parent object. 12
UCS Manager XML Hierarchy Overview Managed Object to UCS PowerTool Command Reference Root Legend equipment network logical sys fabric org-root chassis-1 switch-a LAN cloud SAN cloud bios policy org-prod macpool adaptor-1 blade-1 compute board slot-2 ether vlan22 fc vsan10 boot policy ls-esx-01 lsbinding mac pool block lspower eth0 fc0 temp stats power stats port-1 port-5 13
UCS Manager XML Hierarchy Overview Managed Object to UCS PowerTool Command Reference Legend equipment network logical Get-UcsChassis -Id 1 Get-UcsBlade -SlotId 1 Get-UcsAdaptorUnit -Id 1 Get-UcsAdaptorHostEthIf Root sys fabric org-root chassis-1 switch-a LAN cloud SAN cloud bios policy org-prod macpool adaptor-1 blade-1 compute board slot-2 ether vlan22 fc vsan10 boot policy ls-esx-01 lsbinding mac pool block lspower eth0 fc0 temp stats power stats port-1 port-5 14
UCS Manager XML Hierarchy Overview Managed Object to UCS PowerTool Command Reference Get-UcsLanCloud Add-UcsVlan -name vlan22 -id 22 Legend equipment network logical Root sys fabric org-root chassis-1 switch-a LAN cloud SAN cloud bios policy org-prod macpool adaptor-1 blade-1 compute board slot-2 ether vlan22 fc vsan10 boot policy ls-esx-01 lsbinding mac pool block lspower eth0 fc0 temp stats power stats port-1 port-5 15
UCS Manager XML Hierarchy Overview Managed Object to UCS PowerTool Command Reference Get-UcsOrg -name root Add-UcsMacPool -Name esx-macs Add-UcsMacMemberBlock From 00:25:B5:00:00:00 -To 00:25:B5:00:00:00 Root Legend equipment network logical sys fabric org-root chassis-1 switch-a LAN cloud SAN cloud bios policy org-prod macpool adaptor-1 blade-1 compute board slot-2 ether vlan22 fc vsan10 boot policy ls-esx-01 lsbinding mac pool block lspower eth0 fc0 temp stats power stats port-1 port-5 16
PowerTool Creation / Installation / Get- Help / Parameters
Cisco UCS PowerTool Automated Code Creation Automated Activity Generation from UCS XML Schema UCSM-IN.xsd UCSM-OUT.xsd UCS XML Schema Processor Augment Schema XML Method & MO Meta Information PowerShell Generator Integration 1 Generator Cisco UCS PowerTool Thousands of Cmdlets Integration 1 Integration N Generator Integration N 18
Download / Install / Count the Cmdlets Download from CCO UCS Integrations Latest Version 2.3.1.5 Cisco_UCS_PowerTool_Suite_2.3.1.5.msi PowerTool Suite Install what you need PowerTool C:\> Get-Command -Module Cisco.UCSManager Measure 2406 PowerTool C:\> Get-Command -Module Cisco.IMC Measure 728 PowerTool C:\> Get-Command -Module Cisco.UCSCentral Measure 2438 5572 Cmdlets in total 19
Get-Help 20
Parameters 21
UCS Cmdlet / Object Meta Data Find the Class Id / Cmdlet Noun
UCS Cmdlet Meta Data Verbs 23
UCS Cmdlet Meta Data Hierarchy 24
UCS Cmdlet Meta Data Attributes & Properties 25
Find the Class Id 26
Find the Cmdlet Noun 27
Connections / Parallelism / -Xml / Transactions / Code Generation
UCS Connections Connect-Ucs returns a UcsHandle on a successful connection Connect to 1 UCS, by Name/IP Connect to n UCS, by Name/IP, with the same credentials Connect to n UCS with information from a file, protected by a key If -NotDefault is not specified, handles go to a Default UcsHandle list By default, not more than 1 UcsHandle is allowed in the Default UcsHandle list Override with: Set-UcsPowerToolConfiguration -SupportMultipleDefaultUcs $true Refresh of the connection happens in the background Get-UcsPSSession to see the Default UcsHandle list Export-UcsPSSession to save a set of UcsHandles to file 29
UCS PowerTool Parallelism Connected to Multiple UCS Domains When connected to multiple UCS, any request is sent to all systems in parallel. Get-UcsChassis Not Parallel Get-UcsChassis Parallel 30
-Xml 31
Transactions A set of requests can be sent to UCS in a single transaction. Only Add-* or Set-* cmdlets can be used in a transaction Requests without transaction Get-UcsServiceProfile Server1 Set-UcsServiceProfile -Descr Description1 <configconfmos cookie="" inhierarchical="false"><inconfigs><pair key="org-root/ls-server1"><lsserver descr="description1" dn="org-root/ls-server1" status="modified" /></pair></inconfigs></configconfmos> Get-UcsServiceProfile Server2 Set-UcsServiceProfile -Descr Description2 <configconfmos cookie="" inhierarchical="false"><inconfigs><pair key="org-root/ls-server2"><lsserver descr="description2" dn="org-root/ls-server2" status="modified" /></pair></inconfigs></configconfmos> Same requests within transaction $sp1 = Get-UcsServiceProfile Server1 $sp2 = Get-UcsServiceProfile Server2 Start-UcsTransaction $sp1 Set-UcsServiceProfile -Descr Description1 -Force $sp2 Set-UcsServiceProfile -Descr Description2 Force Complete-UcsTransaction Xml <configconfmos cookie="" inhierarchical="false"><inconfigs><pair key="org-root/ls-server1"><lsserver descr="description1" dn="org-root/ls-server1" status="modified" /></pair><pair key="org-root/ls- Server2"><lsServer descr="description2" dn="org-root/ls-server2" status="modified" /></pair></inconfigs></configconfmos> Pending transactions can be undone using Undo-UcsTransaction 32
Code Generation ConvertTo-UcsCmdlet / New Way Steps: 1. Launch PowerTool 2. Launch UCS Manager - HTML 3. Ctrl-Alt-q to record XML 4. Record XML 5. Create VLAN in UCSM 6. Stop XML Recording 7. Download File 8. Use file as input to ConvertTo-UcsCmdlet 33
Code Generation ConvertTo-UcsCmdlet / New Way 34
Compare & Sync
Compare & Sync Managed Objects (MO) Compare-UcsManagedObject & Sync-UcsManagedObject work on a set of Managed Objects, in a generic manner. The usage scenarios are many.. esp. when considered with -XlateOrg Translate Org org-root/org-prod org-root/org-test -XlateMap Map of entities to be translated -DeleteNotPresent Delete from Target if not present on Source -NoVersionFilter Ignore Object Version Reference Compare Vlans between Target and Source Compare-UcsMo $(Get-UcsVlan -Ucs $ucstarget) $(Get-UcsVlan -Ucs $ucssource) Sync Vlans between Target and Source Sync-UcsMo -Ucs $ucs2 $(Compare-UcsMo $(Get-UcsVlan -Ucs $ucs2) $(Get-UcsVlan -Ucs $ucs1)) 36
Compare Managed Objects (MO) 1. $sourceorg = Get-UcsOrg -Name root Add-UcsOrg -Name A -ModifyPresent 2. $targetorg = Get-UcsOrg -Name root Add-UcsOrg -Name B ModifyPresent 3. $sp = Add-UcsServiceProfile -Org $sourceorg -Name abc 4. $xlatedn = @{}; $xlatedn['org-root/org-a/ls-abc'] = 'org-root/org-b/ls-xyz' 5. Compare-UcsManagedObject (Get-UcsServiceProfile -Org $targetorg -Name xyz - LimitScope) (Get-UcsServiceProfile -Org $sourceorg -Name abc -LimitScope) -XlateMap $xlatedn org-root/org-b/ls-xyz Cisco.Ucsm.LsServer => 6. Compare-UcsManagedObject (Get-UcsServiceProfile -Org $targetorg -Name xyz -LimitScope) (Get-UcsServiceProfile -Org $sourceorg -Name abc -LimitScope) -XlateOrg org-root/org-b org-root/org-b/ls-abc Cisco.Ucsm.LsServer => 7. Sync-UcsManagedObject (Compare-UcsManagedObject (Get-UcsServiceProfile -Org $targetorg -Name xyz -LimitScope) (Get-UcsServiceProfile -Org $sourceorg -Name abc -LimitScope) -XlateMap $xlatedn) WhatIf What if: Performing the operation "Add" on target "UCSPE-192-168-220-151:org-root/org-B/ls-xyz". 37
Compare & Sync Managed Objects (MO) 1. $ucscred = Get-Credential 2. $ucssource = Connect-Ucs -Name 192.168.220.151 -Credential $ucscred NotDefault 3. $ucstarget = Connect-Ucs -Name 192.168.220.173 -Credential $ucscred NotDefault 4. $ucs_lancloud = Get-UcsLanCloud Ucs $ucssource 5. 200..204 %{Add-UcsVlan -LanCloud $ucs_lancloud -Ucs $ucssource -Name vlan$_ -Id $_} 6. Compare-UcsMo $(Get-UcsVlan -Ucs $ucstarget) $(Get-UcsVlan -Ucs $ucssource) 7. Get-UcsLanCloud -Ucs $ucstarget Add-Ucsvlan -Ucs $ucstarget -name vlanextra210 -Id 210 8. Sync-UcsMo -Ucs $ucstarget $(Compare-UcsMo $(Get-UcsVlan -Ucs $ucstarget) $(Get-UcsVlan -Ucs $ucssource)) -WhatIf DeleteNotPresent What if: Performing the operation "Add" on target "UCSPE-192-168-220-173:fabric/lan/net-vlan200". What if: Performing the operation "Add" on target "UCSPE-192-168-220-173:fabric/lan/net-vlan201". What if: Performing the operation "Add" on target "UCSPE-192-168-220-173:fabric/lan/net-vlan202". What if: Performing the operation "Add" on target "UCSPE-192-168-220-173:fabric/lan/net-vlan203". What if: Performing the operation "Add" on target "UCSPE-192-168-220-173:fabric/lan/net-vlan204". What if: Performing the operation "Remove" on target "UCSPE-192-168-220-173:fabric/lan/net-vlanExtra210". 38
Microsoft DSC UCS Desired State Configuration
UCS Desired State Configuration (DSC) Resource 40
Demo
Get hands-on with APIs and SDKs in the DevNet Zone LEARN CODE INSPIRE CONNECT In the DevNet Zone we offer: Classrooms Learn about a specific topic/technology NEW! Hack, Defend and Win! Embrace your inner hacker, then defend the network! Black Hat, White Hat Security Challenge DevNet Sandbox Explore free technology-packed 24x7 labs and play IoT foosball! Go for a 5-minute mini-hack challenge or complete all three in 15-minutes to win Learning Labs Find an open seat to start coding with self-paced tutorials (experts available) Panels Get inspired & interact with industry experts Connected Women s Event Join Susie Wee on Monday for this event followed by a DevNet Zone open house NEW! Application Developer Zone and Challenge Win a special-edition t-shirt and bragging rights complete a learning lab, a workshop, and an application developer demo Demos Exciting demos and inspiring partner solutions showcase Join DevNet! developer.cisco.com/join/cleur18 All DevNet members win a prize, visit the Info Desk to learn more! Workshops code with an instructor in a @CiscoDevNet #DevNet #CLEUR
Hack, Defend, and Win! Come play the Black Hat, White Hat Security Challenge in the DevNet Zone! >>> Hack Embrace your inner hacker and try to access the network >>> Defend Be the heavily-armed Cisco defender that saves the day >>> Win Collect your prize and claim your bragging rights @CiscoDevNet #DevNet #CLEUR
Cisco Spark How Questions? Use Cisco Spark to communicate with the speaker after the session 1. Find this session in the Cisco Live Mobile App 2. Click Join the Discussion 3. Install Spark or go directly to the space 4. Enter messages/questions in the space cs.co/ciscolivebot#
Please complete your Online Session Evaluations after each session Complete 4 Session Evaluations & the Overall Conference Evaluation (available from Thursday) to receive your Cisco Live T-shirt All surveys can be completed via the Cisco Live Mobile App or the Communication Stations Complete Your Online Session Evaluation Don t forget: Cisco Live sessions will be available for viewing on-demand after the event at www.ciscolive.com/global/on-demand-library/.
Continue Your Education Demos in the Cisco campus Walk-in Self-Paced Labs Tech Circle Meet the Engineer 1:1 meetings Related sessions 46
Thank you