Skip to main content

HPE OneView Python Library

Project description

HPE OneView SDK for Python

Build Status

OV Version 8.70 8.60 8.50 8.40 8.30 8.20 8.10 8.00 7.20 7.10 7.00 6.60 6.50 6.40 6.30 6.20 6.10 6.00 5.60
SDK Version/Tag v8.7.0 v8.6.0 v8.5.1 v8.4.0 v8.3.0 v8.2.0 v8.1.0 v8.0.0 v7.2.0 v7.1.0 v7.0.0 v6.6.0 v6.5.0 v6.4.0 v6.3.0 v6.2.0 v6.1.0 v6.0.0 v5.6.0
Build Status Build status Build status Build status Build status Build status Build status Build status Build status Build status Build status Build status Build status Build status Build status Build status Build status Build status

Introduction

HPE OneView makes it simple to deploy and manage today’s complex hybrid cloud infrastructure. HPE OneView can help you transform your data center to software-defined, and it supports HPE’s broad portfolio of servers, storage, and networking solutions, ensuring the simple and automated management of your hybrid infrastructure. Software-defined intelligence enables a template-driven approach for deploying, provisioning, updating, and integrating compute, storage, and networking infrastructure.

The HPE OneView Python library provides a pure Python interface to the HPE OneView REST APIs. It depends on the Python-Future library to provide Python 2/3 compatibility.

You can find the latest supported HPE OneView Python SDK here

Refer to

Supported HPE OneView Python APIs Implementation and Latest version of the OneView Python SDK Documentation

What's New

HPE OneView Python library extends support of the SDK to OneView REST API version 6000 (OneView v8.70)

Migration script

Perform migration from HPE OneView 6.x to HPE OneView 7.0 for non-Synergy appliance using below script.

   $ git clone https://github.com/HewlettPackard/oneview-python.git
   $ cd oneview-python/examples/migration/
   $ python migrate.py [<list of server hardwware names to be migrated>] 

Please refer to notes for more information on the changes , features supported and issues fixed in this version

Getting Started

HPE OneView SDK for Python can be installed from Source,Pypi and Docker container installation methods.

From Source

$ git clone https://github.com/HewlettPackard/oneview-python.git
$ cd oneview-python 
$ python setup.py install --user  # to install in the user directory (~/.local)
$ sudo python setup.py install    # to install globally

Or using PIP:

$ git clone https://github.com/HewlettPackard/oneview-python.git 
$ cd oneview-python 
$ pip install . 

From Pypi

$ git clone https://github.com/HewlettPackard/oneview-python.git
$ cd oneview-python 
$ pip install hpeOneView 

From Docker Image / Container

Clone this repo and cd into it:

$ git clone https://github.com/HewlettPackard/oneview-python.git
$ cd oneview-python

Build the docker image:

$ docker build -t oneview-python . 

Now you can run any of the example in this directory: Run the container, passing in your credentials to OneView and specifying which example recipe to run.
-v: The volume on which repo code is mounted
Replace connection_templates with the name of the example you'd like to run
Replace pwd with the path of the example file you'd like to run.

$ docker run -it --rm \ -v $(pwd)/:/root/oneview/ python examples/connection_templates.py

Running Examples with published docker image

We also provide a lightweight and easy way to test and run oneview-python. The hewlettpackardenterprise/hpe-oneview-sdk-for-python: docker image contains an installation of oneview-python installation you can use by just pulling down the Docker Image:

The Docker Store image tag consist of two sections: <sdk_version-OV_version>

Download and store a local copy of hpe-oneview-sdk-for-python and use it as a Docker image.

$ docker pull hewlettpackardenterprise/hpe-oneview-sdk-for-python:v8.7.0-OV8.7

Run docker commands and this will in turn create sh session where you can create files, issue commands and execute the tests

$ docker run -it hewlettpackardenterprise/hpe-oneview-sdk-for-python:v8.7.0-OV8.7 /bin/sh

Configuration

JSON:

Connection properties for accessing the OneView appliance can be set in a JSON file. Before running the samples or your own scripts, you must create the JSON file. An example can be found at: OneView configuration sample.

Note: If you have an active and valid login session and want to use it, define the sessionID in the Credentials. When sessionID is defined, you can remove username and password from your JSON (they will be disregarded anyway).

Once you have created the JSON file, you can initialize the OneViewClient:

from hpeOneView.oneview_client import OneViewClient
oneview_client = OneViewClient.from_json_file('/path/config.json')

:lock: Tip: Check the file permissions because the password is stored in clear-text.

Environment Variables:

Configuration can also be defined through environment variables:

Required

export ONEVIEWSDK_IP='172.16.102.82'
export ONEVIEWSDK_USERNAME='Administrator'
export ONEVIEWSDK_PASSWORD='secret123'

Or sessionID

 export ONEVIEWSDK_SESSIONID='123'

Once you have defined the environment variables, you can initialize the OneViewClient using the following code snippet:

 from hpeOneView.oneview_client import OneViewClient
 oneview_client = OneViewClient.from_environment_variables()

:lock: Tip: Make sure no unauthorized person has access to the environment variables, since the password is stored in clear-text.

Note: If you have an active and valid login session and want to use it, define the ONEVIEWSDK_SESSIONID. When a sessionID is defined, it will be used for authentication (username and password will be ignored in this case).

Dictionary:

# You can also set the configuration using a dictionary. As described above, for authentication you can use username/password:
config = { 
  "ip": "172.16.102.82", 
  "credentials": { 
      "userName": "Administrator",
      "password": "secret123"
  }
}
#Or if you have an active and valid login session and want to use it, define the sessionID in the Credentials:
config = {
  "ip": "172.16.102.82",
  "credentials": { 
      "sessionID": "123" 
  } 
}
# If you need to use a proxy server, You can add the same in config dictionary as below:
config = { 
  "ip": "172.16.102.82",
  "proxy": "1.2.3.4:8080",
  "credentials": {
      "userName": "Administrator",
      "password": "secret123"
  }
}
 from hpeOneView.oneview_client import OneViewClient
 oneview_client = OneViewClient(config) 

:lock: Tip: Check the file permissions because the password is stored in clear-text.

For more details on the Installation , Configuration , Logging , Troubleshooting refer to WIKI# Installation & Configuration section.

HPE Synergy Image Streamer

From Release 8.1, Image streamer is no longer supported.

Getting Help

Are you running into a road block? Have an issue with unexpected bahriov? Feel free to open a new issue on the issue tracker

For more information on how to open a new issue refer to How can I get help & support

License

This project is licensed under the Apache license. Please see LICENSE for more information.

Additional Resources

HPE OneView Documentation

HPE OneView Release Notes

HPE OneView Support Matrix

HPE OneView Installation Guide

HPE OneView User Guide

HPE OneView Online Help

HPE OneView REST API Reference

HPE OneView Firmware Management White Paper

HPE OneView Deployment and Management White Paper

HPE OneView Community

HPE OneView Community Forums

Learn more about HPE OneView at hpe.com/info/oneview

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hpeOneView-8.7.0.tar.gz (93.2 kB view details)

Uploaded Source

Built Distribution

hpeOneView-8.7.0-py3-none-any.whl (190.8 kB view details)

Uploaded Python 3

File details

Details for the file hpeOneView-8.7.0.tar.gz.

File metadata

  • Download URL: hpeOneView-8.7.0.tar.gz
  • Upload date:
  • Size: 93.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for hpeOneView-8.7.0.tar.gz
Algorithm Hash digest
SHA256 983ec08bd48077466a7351c2538831e65f547a88a18c420ad26cdeaa8c88e81d
MD5 89e318ccf8192e33d005d14a5ce9a3bb
BLAKE2b-256 d2960d7d732401870100fbc39d8f4c62d27dbf9ec2dd4f7b1e62e99cd2287ab6

See more details on using hashes here.

File details

Details for the file hpeOneView-8.7.0-py3-none-any.whl.

File metadata

  • Download URL: hpeOneView-8.7.0-py3-none-any.whl
  • Upload date:
  • Size: 190.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for hpeOneView-8.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 543a5b5ac12e4f72772a4115c11526464671fde0a2ef45d03640bec76f90273c
MD5 64e5b05a3d1fbe68e97130a61f3f17ce
BLAKE2b-256 a571bdcd25bb42304194bac5e1f3b4f0e4d6cfcf2ce595f6e9f26267ba2fd54a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page