HP OneView Deployment and Management Guide 1.05

Technical white paper | HP OneView Deployment and Management Guide
106
Please visit the HP OneView Online Documentation page (https://hponeview.codeplex.com/documentation) for all available
CMDLETs and the associated help.
Using PowerShell
Note
The following example assumes the HP OneView POSH Library is installed with the available install package.
The HP OneView PowerShell library is a self-contained module that you first need to import, or add to your PowerShell
Session Profile. After the module has been successfully imported, you must first execute Connect-HPOVmgmt in order to
authenticate to the appliance. You can then execute other cmdlets to perform the desired action.
1. Execute Import-Module HPOneView
A. Example:
PS C:\Users\Administrator> Import-Module HPOneView
Welcome to the HP OneView POSH Library, v1.05
To get a list of available CMDLETs in this library, type : Get-Help hpov
To get help for a specific command, type: get-help [verb]-HPOV[noun]
To get extended help for a specific command, type: get-help [verb]-HPOV[noun] full
If you need further help, please consult one of the following:
• Get-Help about_HPOneView
• Oneline documentation at https://hponeview.codeplex.com/documentation
• Oneline Issues Tracker at https://hponeview.codeplex.com/workitem/list/basic
Copyright (C) 2014 Hewlett-Packard
2. Execute the Connect-HPOVmgmt CMDLET
A. Example
[HPONEVIEW]: [Not Connected] PS> Connect-HPOVmgmt -appliance appliance.example.com user
Administrator password hp1nvent
[HPONEVIEW]: administrator@appliance.example.com PS>
3. Once you have authenticated to the appliance, you can execute different CMDLETs provided by the library
A. Example
[HPONEVIEW]: administrator@appliance.example.com PS> New-HPOVNetwork –Type “Ethernet” –Name
“Blue” –VLANID 100
Creating Blue Ethernet Network
Accessing the ReST API with Python
Python comes with a few libraries that can complete REST requests like httplib2 and urllib2, these libraries are rather
difficult to use and require a lengthy learning curve. Another python library called "Requests" has solved the learning curve,
cleaned up REST requests and made them very easy to use. For a full comparison take a look at
http://isbullsh.it/2012/06/Rest-api-in-python/
This overview of using Python to create REST requests will feature the Requests library.
Requests
Requests (http://docs.python-requests.org/en/latest/) is an easy to use REST request Python library.
How to get Requests
To get requests follow the steps on the Requests website here: http://docs.python-
requests.org/en/latest/user/install/#install
The best method would be to use pip (the python package manager) to install requests:
> pip install requests