intégration cisco ucs en environnement microsoft - part 2

30
Cisco Confidential © 2013 Cisco and/or its affiliates. All rights reserved. 1 Introduction to… UCS Management Emulator & PowerShell with PowerTool 19/05/2014 Franck Bonneau Consulting Systems Engineer [email protected]

Upload: cisco

Post on 30-Oct-2014

250 views

Category:

Technology


4 download

DESCRIPTION

Ensemble, Microsoft et Cisco offrent des solutions flexibles, ouvertes et innovantes, pour vos besoins IT. Nous travaillons conjointement depuis le début d’UCS pour faciliter l’exploitation des environnements physiques et virtuels. Vous découvrirez dans cette présentation l’intégration Cisco UCS avec la suite Microsoft System Center et les capacités de scripting PowerShell, ainsi que la gestion des réseaux virtuels en environnement Hyper-v grâce au Nexus 1000v et VM-FEX sur UCS.

TRANSCRIPT

Page 1: Intégration Cisco UCS en environnement Microsoft - PART 2

Cisco Confidential © 2013 Cisco and/or its affiliates. All rights reserved. 1

Introduction to…

UCS Management Emulator &

PowerShell with PowerTool

19/05/2014

Franck Bonneau

Consulting Systems Engineer

[email protected]

Page 2: Intégration Cisco UCS en environnement Microsoft - PART 2

Cisco Confidential 2 © 2013 Cisco and/or its affiliates. All rights reserved.

Page 3: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3

• Emulates UCSM

1. Full GUI features

2. Blades (But can’t boot them and install an OS)

3. API (PowerTool, etc.)

4. Can’t get environmentals

Everything runs cool in a virtual world !

5. Partial UCSM CLI

(NO connect nxos or connect local-mgmt)

Page 4: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4

• Cisco Developer Site

http://developer.cisco.com/web/unifiedcomputing/ucsemulatordownload

Direct Link : https://communities.cisco.com/docs/DOC-37827

Download the ZIP file and the PDF documents

***Must have a Cisco login to download***

Page 5: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5

• UCSM Emulator is provided in VMWare and OVA formats

SORRY !

• Can convert to work in Hyper-V

Documented process in Emulators User Guide

Search for - Launching Cisco UCS Platform Emulator Using Microsoft Hyper-V

Basically converting the VMWare virtual hard disk (VMDK) to a VHD and then creating a virtual machine with the appropriate settings.

Page 6: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 6

• Connect to the console of the UCSM VM

• Start the VM

• WAIT

• After the emulator has fully started, login with config/config

• Select option (a) from the console menu

(a) View & Configure Network Settings Change settings? (y/n): y Use DHCP? (y/n): y or n, if ‘n’ then proceed eth0: Enter IP Address: x.x.x.x (This is the IP Address of Fabric Interconnect A) eth0: Enter netmask (255.x.x.x): x.x.x.x eth1: Enter IP Address: x.x.x.y (This is the IP Address of Fabric Interconnect B) eth1: Enter netmask (255.x.x.x): x.x.x.x eth2: Enter IP Address: x.x.x.z (This is the IP Address the management VIP) eth2: Enter netmask (255.x.x.x): x.x.x.x Enter default gateway: x.x.x.a

• WAIT till the menu is back up in the console

Page 7: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7

• Open a web browser to the IP Address of the UCSMe VIP

Or

• SSH to the IP Address of the UCSMe VIP

Page 8: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8

• Select Launch UCS Manager

• User name will be ‘admin’, password is <none or anything>

Remember: Java required on your machine

Note: Changing Emulator Settings requires Firefox browser (Sorry….Again!)

Page 9: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 9

• Setting the emulator back to factory settings takes a LONG time.

• If you are going to play around with configs and then want to restore to factory quickly, do this.

Go to the Admin Tab

Set the filter to All

Highlight ‘All’

Select Backup Configuration

Select Create Backup Operation

Admin State: Enabled

Type: All Configuration

Preserve Identities: Checked

Location of the Backup File: Local File System

Browse and pick location and file name – Suggest – Emulator_Blank.xml

Page 10: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10

• Now, when you want to get back to the factory config without losing your IP addressing do this:

Go to the Admin Tab

Set the filter to All

Highlight ‘All’

Select Import Configuration

Select Create Import Operation

Admin State: Enabled

Action: Replace

Location of the Import File: Local File System

Browse and select the Emulator_Blank.xml file

Wait about 2 minutes and you are set to start playing again!

Page 11: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 11

Quick run through of the UCSMe

Show default configuration

Show Emulator Settings

Page 12: Intégration Cisco UCS en environnement Microsoft - PART 2

Cisco Confidential 12 © 2013 Cisco and/or its affiliates. All rights reserved.

Page 13: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 13

• Microsoft’s goal: all GUIs in Windows should be front-end to Powershell

• Powershell is CLI-driven

scripting/programming language with access to all .NET objects

ideal for automating Windows-oriented tasks

not limited to Windows: Cisco UCS module, VMware module, etc.

• Current version is v4

Microsoft Introduced it’s first scripting option for Windows in 1998

PowerShell v1.0 introduced in 2006

Today we are at v4.0 in Windows 8.1/2012R2

Preinstalled in Windows 7 and 2008 R2

• Available for free from http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx

• Integrated Scripting Environment (ISE) an optional feature on Windows

• Everything you can do in the GUI can be automated using Powershell

We are very close to being able to do ANYTHING with Windows and Microsoft applications with PowerShell

• Two flavors: 64-bit and 32-bit

use the 64-bit version; the 32-bit is there for compatibility reasons

Page 14: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 14

• Always Run as Administrator

Page 15: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 15

• Powershell built-in commands (pronounced “command lets”)

3rd party modules add cmdlets to existing native library

• Find cmdlets using “get-command *your_topic*”

wildcards accepted

• Find help topics using “help *your_topic*”

• Cmdlets follow a naming convention:

verb hyphen noun [dash name space value]

• Help <cmdlet> is your friend

help <cmdlet> -full details parameter usage

help <cmdlet> -examples provides sample uses

• Help is actually a wrapper for Get-Help which automatically pipes the output to the more function

Page 16: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16

• Powershell’s ability to take output from one cmdlet and feed it to another

keep in mind that unlike a Unix shell, the output of a cmdlet isn’t necessarily just text, it can be a full-blown .NET object or an array of objects!

this is where the power of Powershell really is

• Stupid example:

Get-Process | Stop-Process

Don’t run that command … it takes each and every process and runs stop-process against them

• More realistic examples

Get-Process | ConvertTo-CSV | Out-File myProcesses.csv

Get-Process –name Notepad | Stop-Process

• You can always use the –whatif parameter to perform a dry-run

Page 17: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 17

• There is only one Powershell

A vendor doesn’t give you a new version of Powershell

• Powershell can be extended using two mechanisms

Snapins

Modules

• To add a snap-in, you use add-pssnapin <name>

• to list new cmdlets: get-command –pssnapin <name>

• to view installed snap-ins, use get-pssnapin -registered

• Modules are v2 only

PS looks for them in env variable PSModulePath

Get-content env:psmodulepath to retrieve variable

Get-module –listavailable to list modules

Supposed to be more self-contained than snap-ins

Import module with import-module <module> cmdlet

List cmdlets from module with gcm –module <module> gcm is an alias for get-command

Page 18: Intégration Cisco UCS en environnement Microsoft - PART 2

Cisco Confidential 18 © 2013 Cisco and/or its affiliates. All rights reserved.

Page 19: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 19

• Comprehensive XML API, standards-based interfaces

• Bi-Directional access to physical & logical internals

Direct CLI GUI API Cisco

Page 20: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 20

• PowerTool is a module for PowerShell

• Automatically generated by Cisco for each major UCSM release

99% auto generated

• ~100% of what you can do in UCSM CLI and GUI you can do in PowerTool

• Full .NET

Cisco UCS

PowerTool Module

UCS .NET Namespace

UCS XML API

cmdlets

Page 21: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 21

• Cisco Connection Online

http://www.cisco.com

***Must have a Cisco login***

Select: Support, then All Downloads

Find: Cisco UCS Management Partner Ecosystem Software

Select: Unified Computing System (UCS) PowerTool

Select the latest version and download

Get the documentation

In the main search option in Cisco Connection Online enter: PowerTool

Scroll down and select the Release Notes

At the bottom of this link is also a link to the Users Guide

Page 22: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 22

• Run the install and do the normal NEXT NEXT NEXT FINISHED

• You now have the module installed on your PC

• Default location is:

C:\Program Files (x86)\Cisco\Cisco UCS PowerTool\Modules\CiscoUcsPS

• A batch file is available in your start menu to open PowerShell and load the module

• Of course your machine needs to support PowerShell and have PowerShell allowed to execute….

In case PowerShell is dissabled on your PC, use the command below to enable it :

Enable: “Set-ExecutionPolicy –ExecutionPolicy Unrestricted –Force”

Page 23: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 23

Demonstrate PowerTool

Connect UCS & Multi UCS NIC Rename Multi-UCS KVM Available Slots

Page 24: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 24

• Wouldn’t it be nice to get help using PowerShell?

You can!

• Get into your UCSM GUI

• Launch PowerTool

Type: ConvertTo-UcsCmdlet

• Do something in UCS and hit ‘SAVE’

• Look for the output in your PowerShell window

First time takes a bit for the output to show

Page 25: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25

• Logging into a UCS

$cred = get-credential

$myucs = “x.x.x.x”

Connect-Ucs -Credential $cred -Name $myucs

• Logging into a bunch of UCS domains

$cred = get-credential

$myucs = @(“x.x.x.x”, “y.y.y.y”, “z.z.z.z”)

foreach ($myucslist in $myucs)

{

$myCon = Connect-Ucs -Credential $cred -name $myucslist

}

• Disconnect from UCSM

Disconnect-ucs

Page 26: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 26

• Ajouter un vlan

Get-UcsLanCloud | add-UcsVlan -Name ESX_VMNIC_1 -Id 101

• Delete Range de VLANs

Get-UcsVlan | ? {$_.Id -ge 100 -and $_.Id -le 110 } | Remove-UcsVlan –Force

Page 27: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 27

Log into UCSM

clear

$cred = Get-Credential

$myucs = "10.60.0.231"

$mycon = Connect-Ucs -Name $myucs -Credential $cred

$blades = Get-UcsBlade

Disconnect-Ucs

Log into multiple UCSM domains

clear

$multilogin = Set-UcsPowerToolConfiguration -SupportMultipleDefaultUcs $true

$cred = Get-Credential

$myucs = @(“10.60.0.231",“192.168.46.138")

$mycon = Connect-Ucs -Name $myucs -Credential $cred

#do your thing

$blades=get-ucsblade

Disconnect-Ucs

Save the Output in file

clear

$multilogin = Set-UcsPowerToolConfiguration -SupportMultipleDefaultUcs $true

$cred = Get-Credential

$myucs = @(“10.60.0.231",“192.168.46.138")

$mycon = Connect-Ucs -Name $myucs -Credential $cred

#do your thing

$blades=get-ucsblade

Write-Output "Model Cores Memory" | Out-File test.csv

ForEach ($blade in $blades){

Write-Output "$($blade.Model) $($blade.NumOfCores) $($blade.TotalMemory)" | Out-File -Append c:\Tmp\test.csv}

Disconnect-Ucs

Page 28: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 28

• More PowerShell Exemples :

https://communities.cisco.com/people/joemar/content

• XML API and other tools:

https://developer.cisco.com/site/data-center/ucs-system-mgmt/ucs-dev-center/documentation/index.gsp

Page 29: Intégration Cisco UCS en environnement Microsoft - PART 2

© 2013 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 29

Page 30: Intégration Cisco UCS en environnement Microsoft - PART 2

Merci de votre participation

Prenez connaissance de nos évènements sur

www.cisco.fr/go/evenements