ucs automation through the use of api's and ucs powertool
TRANSCRIPT
Cisco Confidential© 2015 Cisco and/or its affiliates. All rights reserved. 1
Managing UCS throughAPI’s and PowertoolWillem van Schaik & Rohan KaramandiDC Systems Engineers
2016 May 18th
In collaboration with
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
Agenda
• Introduction
• What resources are available to get started automating UCS Infrastructure?
• Cisco UCSM’s Programmatic Infrastructure
Cisco UCS PowerTool for UCS Manager
DEMO / LAB: Using UCS PowerTool for UCSM
• Cisco IMC’s Programmatic Infrastructure
Cisco UCS PowerTool for IMC
DEMO / LAB: Using UCS PowerTool for IMC
• UCS PowerTool Free-form Coding as a Group
• Conclusion
Cisco Confidential 3© 2015 Cisco and/or its affiliates. All rights reserved.
What resources are available to get started automating UCS ?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4
Cisco UCS User Communityhttp://communities.cisco.com/ucs
• Web Based End User Community
• Tools, Downloads, ExamplesUCS Platform Emulator (UCSPE)
Python SDK
XML API, PowerShell code Examples
Cisco UCS PowerTool (PowerShell Module)
Microsoft SCOM Management Pack for Cisco UCS
Microsoft SCVMM UI Extension for Cisco UCS
Microsoft SCO Integration Pack for Cisco UCS
• DocumentationProgramming & Developer Guides
Whitepapers
Reference Guides (XML Model, Faults)
• CollaborationBlogs
Peer to peer forums
Videos
Access to Cisco Subject Matter Experts
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
UCS Platform Emulator (UCSPE)http://communities.cisco.com/ucspe
• No UCS Hardware Needed for API integration Development
Full featured emulator for the UCS Manager
Installs as a Virtual Machine
Provides complete support for all XML API calls
Object Browser to peruse the UCSM model
Import & replicate existing live UCS Manager physical inventory
Share saved physical inventories among UCS Platform Emulators
Drag-n-drop hardware builder to create custom physical inventory
Cisco Confidential 6© 2015 Cisco and/or its affiliates. All rights reserved.
What is Cisco UCS Manager’sProgrammatic Infrastructure?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
Cisco Unified Compute System
7
Cisco UCS™ Manager (Read / Write Configuration Interfaces)
UCS Manager GUI and CLI
Cisco UCS Fabric Interconnects(Read Only / Cut Through Interfaces)
SNMP, Syslog, SMTP, SMASH CLP, CIM XML, Smart Call Home
20, 40, 48, and 96 ports
Cisco UCS I/O modules
Cisco UCS Blade Server Chassis
Cisco UCS Blade / Rack Servers(Cut through Interfaces to CIMC)
Serial over LAN, KVM, IPMI
Cisco UCS I/O Adapters
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8
UCS Manager Programmatic Infrastructure
• Comprehensive XML API, standards-based interfaces
• Bi-Directional access to physical & logical internals
XML API
Direct UCS CLI UCS GUI 3rd Party Customer
Self Serve portals
Management Tools
Auditing Tools
System Status
Physical Inventory
Logical Inventory
Broad 3rd party integration support
Faster custom integration for customer use cases
Consistent data and views across ALL interfaces
Cisco Confidential 9© 2015 Cisco and/or its affiliates. All rights reserved.
Cisco UCS PowerToolfor UCS Manager
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10
Cisco UCS PowerTool for UCS ManagerProgrammatic control over UCS hardware
• Architected for Flexibility and coverage
PowerShell Wrapper
Cmdlet definition and structure
Get-help support
.NET UCS Namespace Library
XML API call construction
Class Definition
Validation
• PowerShell Design
In-line get-help support
Full Pipelining support
Fully classed object definition
• .NET Namespace provides common base for all Microsoft focused integration
• Targeted to support full manageability of UCS across multiple releases
Cisco UCS
PowerTool Module
UCS .NET Namespace
UCS XML API
cmdlets
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 11
UCS XML
Schema
Processor
UCSM-IN.xsd
UCSM-OUT.xsd
Augment
Schema
XML Method
& MO Meta
Information
PowerShell
Generator
Microsoft SCO IP
Generator
XYZ
Generator
Cisco UCS
PowerTool
(1850+ cmdlets)
Microsoft SCO
Integration Pack
XYZ
Integration Pack
Cisco UCS PowerTool Automated Code CreationAutomated Activity Generation from UCS XML Schema
11
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 12
Cisco UCS PowerTool for UCS ManagerMost Commonly Used Objects and Assets
• Chassis
Hardware – Power Supply / Fan Modules / IO Modules
Environmental statistical data (Power, cooling, network)
Config and Hardware Faults
• Fabric Interconnect
Hardware – Power Supply / Fan Modules / Network Expansion Modules
Power / cooling / network/ environmental statistical data
Network Elements (VLAN, VSAN, QoS, Port Profiles)
Config and Hardware Faults
• Config OperationsPools (WWN, UUID, MAC, IP)
Policy creation, manipulation, deletion, and consumption
vNIC / vHBA Templates
Service profile template creation, cloning, deletion, and consumption
Simplistic service profile creation (with a limited scope of what is available to configure)
Expert SP creation (use variabilized XML w/ config file)
Compare Managed Objects across orgs and/or domains
Sync Managed Objects across orgs and/or domains
• Service Profiles
Policies (Firmware, Boot Order, vNIC / vHBA config, Storage, IPMI, SoL, BIOS)
Pools (WWN, UUID, MAC, IP)
Configuration Faults
Launch UCS KVM for SP
• Servers
Hardware - CPU, Memory, Adaptors, CIMC
Power Operations
Power / cooling / network /environmental statistical data
Hardware Faults
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 13
UCS Manager XML Hierarchy OverviewManaged Object to UCS PowerTool Command Reference
Root
sys org-root
switch-Achassis-1
fabric
ls-bob
org-prod
blade-1 slot-2
ether fc
port-5port-1
adaptor-1
eth0
compute board
fc0temp stats
power stats
macPool
mac pool
block
lsPowerlsBinding
boot policy
bios policyLAN cloud
SAN cloud
bob vsan10
Legend
equipment network logical
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 14
UCS Manager XML Hierarchy OverviewManaged Object to UCS PowerTool Command Reference
Legend
equipment network logical
Root
sys org-root
switch-A
fabric
ls-bob
org-prod
slot-2
ether fc
port-5port-1
compute board
fc0temp stats
power stats
macPool
mac pool
block
lsPowerlsBinding
boot policy
bios policyLAN cloud
SAN cloud
bob vsan10
Get-UcsChassis -Id 1 | Get-UcsBlade -SlotId 1 | Get-UcsAdaptorUnit -Id 1 | Get-UcsAdaptorHostEthIf
eth0
adaptor-1
blade-1
chassis-1
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 15
UCS Manager XML Hierarchy OverviewManaged Object to UCS PowerTool Command Reference
Legend
equipment network logical
Root
sys org-root
switch-Achassis-1
fabric
ls-bob
org-prod
blade-1 slot-2
ether fc
port-5port-1
adaptor-1
eth0
compute board
fc0temp stats
power stats
macPool
mac pool
block
lsPowerlsBinding
boot policy
bios policySAN cloud
vsan10
Get-UcsLanCloud | Add-UcsVlan -name bob -id 222
bob
LAN cloud
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16
UCS Manager XML Hierarchy OverviewManaged Object to UCS PowerTool Command Reference
Legend
equipment network logical
Get-UcsOrg -name root | Add-UcsMacPool -Name bob123 | Add-UcsMacMemberBlock –From 20:00:00:11:22:00 -To 20:00:00:11:22:10
Root
sys
switch-Achassis-1
fabric
ls-bob
org-prod
blade-1 slot-2
ether fc
port-5port-1
adaptor-1
eth0
compute board
fc0temp stats
power stats
lsPowerlsBinding
boot policy
bios policyLAN cloud
SAN cloud
bob vsan10
org-root
macPool
mac pool
block
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 17
CiscoUcsPS Module Overview
ConvertTo-UcsCmdlet -UcsBackup -LiteralPath
c:\ucs\backup.xml -OutputPath c:\ucs\output.ps1
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 18
Getting Started: ConvertTo-UcsCmdlet
• The best way to discover usage of PowerTool cmdlets and usage
• Usage: Option #1
• Launch UCS GUI & Login
• C:\> ConvertTo-UcsCmdlet
• Usage: Option #2
• C:\> Connect-Ucs 1.2.3.4
• C:\> Start-UcsGuiSession -LogAllXml
• C:\> ConvertTo-UcsCmdlet
• Usage: Option #3
• Create a ‘config-all’ XML backup from UCS Manager
• C:\> ConvertTo-UcsCmdlet -UcsBackup -LiteralPath backup.xml -OutputPath output.ps1
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 19
Getting Started: 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 isn`t 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
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 20
Getting Started: Get-UcsCmdletMeta
Another Great way to learn about the PowerTool cmdlets
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 21
Transactions in UCS PowerTool for UCS Manager• A set of XML requests can be sent to UCS in a single transaction.
• Only Add-* or Set-* cmdlets can be used in a transaction
• Example of requests without transactionGet-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>
• Example of 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
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 22
Transactions in UCS PowerTool for UCS Manager
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 23
UCS PowerTool Parameter Validations
• PowerShell has native support for parameter validation.
• PowerTool uses this feature to ensure parameter validations before sending XML requests.
• A validation in PowerTool falls in one or more of the categories below:Length: minimum and maximum length of a string
Range: minimum and maximum value of an integral type
Value set: set of all possible values for a parameter
Pattern: regular expression based validation
Hybrid: A combination of the above.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 24
UCS PowerTool Parallelism
• When connected to multiple UCS, any request is sent to all systems in parallel.
Get-UcsChassisGet-UcsChassisParallelNot Parallel
Connected to Multiple UCS Domains
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25
UCS PowerTool ParallelismConnected to Multiple UCS Domains
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 26
Managed Object (MO) Versioning
• MO Versioning Information is required to be able to inter-operate between versions of UCS
• Assuming a MO with Properties A,B,C,D
• Field A
• Field B
• Field C
• Field D
Version 1
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 27
Managed Object (MO) Versioning
• MO Versioning Information is required to be able to inter-operate between versions of UCS Schema
• Assuming a field E which was not present in version 1 and was added in version 2.
• Compare-UcsMo method will skip this
field while doing a MO comparison
• Sync-UcsMo will also skip this field while
sending the diff to Version 1 UCS
• As a generic rule, Sync-UcsMo will skip operational properties, unknown properties and operational MOs, unknown MOs
• Field A
• Field B
• Field C
• Field D
Version 1
• Field A
• Field B
• Field C
• Field D
• Field E
Version 2
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 28
Compare & Sync Managed Objects (MO)
• Compare-UcsManagedObject & Sync-UcsManagedObject work on a set of MOs, in a
generic manner.
• The usage scenarios are many .. esp. when considered with -XlateOrg, - XlateMap, -DeleteNotPresent
• The snippet below shows an unassociated SP from one org to another without losing any identifiers, etc. (done in 2 back to back transactions).
Cisco Confidential 29© 2015 Cisco and/or its affiliates. All rights reserved.
Lab – UCS PowerToolfor UCS-Manager
Cisco Confidential 30© 2015 Cisco and/or its affiliates. All rights reserved.
What is Cisco IMC’sProgrammatic Infrastructure?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 31
Events
{xml}HTTP(S)
{xml}
Syslog Server
Events{SNMPTraps}
Polls{SNMPGET}
SNMP-based NMS
Events{Syslog
Messages}
C
I
M
C
SyslogSNMP XML API
MemoryCPU
PCI Adaptors
Fans
PSU
System Board
Fault Engine
IPMI
Cisco UCS C-Series Server
Storage Daemon
InventorySensor Data
Config
Faults
Disk
Storage Controller
Disk Disk Disk
Disk Disk Disk Disk
Architecture of Cisco UCS C-Series IMCUCS
PowerTool
Cisco Confidential 32© 2015 Cisco and/or its affiliates. All rights reserved.
Cisco UCS PowerTool for IMC
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 33
Cisco UCS PowerTool for IMCMost Commonly Used Objects and Assets
• Server InventoryHardware Inventory
CPU
Memory
Motherboard
Power Supplies
Hard Disk Drives
Fans
Environmental statistical data (Power / Temperature)
Hardware Faults
• Equipment OperationsServer Power State Change
Enable / Disable LED
KVM GUI Launch
CIMC User Interface Launch
• CIMC Admin Config OperationsMonitoring (SNMP, Syslog, NTP)
Authentication (Local Users, LDAP, LDAP Group to Role Mapping)
Firmware Management via Host Update Utility Non-Interactive
Import / Export CIMC Configuration
• Server Config OperationsBIOS Settings
Boot Order (Legacy and Precision Boot Config)
Local Storage Configuration
Virtual Interface Card Adaptor Configuration
Compare / Sync Objects across IMC’s
33
• Adaptors
– Storage Controller
– Virtual Interface Card
– LOM’s
– Other PCI devices
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 34
sys
Cisco IMC XML Hierarchy OverviewManaged Object to UCS PowerTool Command Reference
rack-unit-1
adaptor-1
eth0
biosUnit
fc0
biossettings
biosdefaults
compute board
temp stats
power stats
fan module
memoryarray
boot
definition
LAN storage virtmediaEFI
localhyper
threadingturboboost
cpu coresenabled
fan0
power
supply
processor unit-1memory
unit-1
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 35
sys
Cisco IMC XML Hierarchy OverviewManaged Object to UCS PowerTool Command Reference
rack-unit-1
biosUnit
fc0
biossettings
biosdefaults
temp stats
power stats
fan module
boot
definition
LAN storage virtmediaEFI
localhyper
threadingturboboost
cpu coresenabled
Get-ImcAdaptorUnit | Get-ImcAdaptorHostEthIf
memoryarray
adaptor-1
eth0 fan0
power
supply
processor unit-1
compute board
memoryunit-1
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 36
sys
Cisco IMC XML Hierarchy OverviewManaged Object to UCS PowerTool Command Reference
rack-unit-1
adaptor-1
eth0
biosUnit
fc0
biossettings
biosdefaults
temp stats
power stats
fan module
boot
definition
LAN storage virtmediaEFI
localhyper
threadingturboboost
cpu coresenabled
Get-ImcComputeBoard | Get-ImcMemoryArray | Get-ImcMemoryUnit
fan0
power
supply
processor unit-1
compute board
memoryarray
memoryunit-1
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 37
CiscoImcPS Module Overview
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 38
Getting Started: ConvertTo-ImcCmdlet
• The best way to discover the UCS PowerTool cmdlets and usage
• Launch IMC GUI, login, and make changes In CIMC GUI (Example: Configure BIOS Settings)
• Connect via UCS PowerTool for IMC and run:
C:\> Connect-Imc 1.2.3.4
C:\> $BiosSettings = Get-ImcBiosSettings -Hierarchy
C:\> $BiosSettings | ConvertTo-ImcCmdlet
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 39
Getting Started: IMC Connections
• Connect-Imc returns a ImcHandle on a successful connection
Connect to 1 IMC, by Name/IP
Connect to ‘n’ IMC, by Name/IP, with the same credentials
Connect to ‘n’ IMC with information from a file, protected by a key
• If -NotDefault isn`t specified, handles go to a Default ImcHandle list
• By default, not more than 1 ImcHandle is allowed in the Default ImcHandle list
Override with:
Set-ImcPowerToolConfiguration -SupportMultipleDefaultImc $true
• Refresh of the connection happens in the background
• Get-ImcPSSession to see the Default ImcHandle list
• Export-ImcPSSession to save a set of ImcHandles to file
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 40
Transactions in UCS PowerTool for IMC
• A set of XML requests that can be sent and applied to IMC in an optimized fashion, in as few XML transmissions as possible.
IMC supports full sub-tree manipulation in a single XML transmission for:
BIOS Settings
Boot Order
LDAP authentication settings
• Only Add-* or Set-* cmdlets can be used in a transaction
• Pending transactions can be undone using Undo-ImcTransaction
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 41
Transactions in UCS PowerTool for IMC• Example of requests without transaction
$HyperT = Get-ImcBiosSettings | Get-ImcBiosHyperThreading
$HyperT | Set-ImcBiosHyperThreading -VpIntelHyperThreadingTech enabled<configConfMo cookie="" dn="sys/rack-unit-1/bios/bios-settings/Intel-HyperThreading-Tech"
inHierarchical="false"><inConfig><biosVfIntelHyperThreadingTech dn="sys/rack-unit-1/bios/bios-settings/Intel-
HyperThreading-Tech" status="modified" vpIntelHyperThreadingTech="enabled" /> </inConfig></configConfMo>
$Turbo = Get-ImcBiosSettings | Get-ImcBiosTurboBoost
$Turbo | Set-ImcBiosTurboBoost -VpIntelTurboBoostTech enabled<configConfMo cookie="" dn="sys/rack-unit-1/bios/bios-settings/Intel-Turbo-Boost-Tech"
inHierarchical="false"><inConfig><biosVfIntelTurboBoostTech dn="sys/rack-unit-1/bios/bios-settings/Intel-Turbo-Boost-
Tech" status="modified" vpIntelTurboBoostTech="enabled" /></inConfig></configConfMo>
• Example of same requests within transaction
$HyperT = Get-ImcBiosSettings | Get-ImcBiosHyperThreading
$Turbo = Get-ImcBiosSettings | Get-ImcBiosTurboBoost
Start-ImcTransaction
$HyperT | Set-ImcBiosHyperThreading -VpIntelHyperThreadingTech enabled
$Turbo | Set-ImcBiosTurboBoost -VpIntelTurboBoostTech enabled
Complete-ImcTransaction –Xml
<configConfMo cookie="" dn="sys/rack-unit-1/bios/bios-settings" inHierarchical="false"><inConfig><biosSettings
dn="sys/rack-unit-1/bios/bios-settings" status="modified"><biosVfIntelHyperThreadingTech dn="sys/rack-unit-
1/bios/bios-settings/Intel-HyperThreading-Tech" status="modified" vpIntelHyperThreadingTech="enabled"
/><biosVfIntelTurboBoostTech dn="sys/rack-unit-1/bios/bios-settings/Intel-Turbo-Boost-Tech" status="modified"
vpIntelTurboBoostTech="enabled"/> </biosSettings></inConfig></configConfMo>
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 42
UCS C-Series Server
Transactions in UCS PowerTool for IMC
CIMC XMLAPI
Transaction #1:
Create Local User “user14”
Transaction #2:
Create Local User “user15”
Transaction #3:
Configure Three BIOS Settings
Cisco Confidential 43© 2015 Cisco and/or its affiliates. All rights reserved.
Demo – UCS PowerToolfor Cisco IMC
Thank you.
In collaboration with