Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hewlettpackard/oneview-golang
Golang bindings for OneView api's
https://github.com/hewlettpackard/oneview-golang
composable-architecture golang hpe-image-streamer hpe-oneview infrastructure-as-code oneview-api oneview-client oneview-golang synergy
Last synced: 3 months ago
JSON representation
Golang bindings for OneView api's
- Host: GitHub
- URL: https://github.com/hewlettpackard/oneview-golang
- Owner: HewlettPackard
- License: apache-2.0
- Created: 2015-10-02T03:19:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-10-21T05:45:25.000Z (3 months ago)
- Last Synced: 2024-10-22T03:33:31.809Z (3 months ago)
- Topics: composable-architecture, golang, hpe-image-streamer, hpe-oneview, infrastructure-as-code, oneview-api, oneview-client, oneview-golang, synergy
- Language: Go
- Homepage:
- Size: 7.07 MB
- Stars: 27
- Watchers: 14
- Forks: 21
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# HPE OneView SDK for GoLang
## Build Status
| OV Version | 9.20 | 9.10 | 9.00 | 8.90 |8.80 | 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 |
| -------------: | -------------: | -------------: | -------------: | --------------:| --------------:| --------------:| --------------: |--------------: |--------------: | -----------: |-----------: | ------------: | -------------: |-----------: | ----------: |-----------: |-----------: | -----------: |-----------: |-----------: |-----------: |-----------: |-----------: |
| SDK Version/Tag |[v9.2.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/9.2.0)|[v9.1.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/9.1.0)|[v9.0.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/9.0.0)|[v8.9.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.9.0)|[v8.8.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.8.0)|[v8.7.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.7.0)|[v8.6.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.6.0)|[v8.5.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.5.0)|[v8.4.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.4.0)| [v8.3.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.3.0) | [v8.2.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.2.0)| [v8.1.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.1.0) | [v8.0.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v8.0.0) | [v7.2.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v7.2.0) | [v7.1.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v7.1.0) | [v7.0.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v7.0.0)| [v6.6.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v6.6.0)| [v6.5.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v6.5.0) | [v6.4.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v6.4.0) | [v6.3.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v6.3.0) | [v6.2.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v6.2.0) | [v6.1.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v6.1.0) | [v6.0.0](https://github.com/HewlettPackard/oneview-golang/releases/tag/v6.0.0) |
| Build Status |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/11390506472)|[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/10714234089)|[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/8918939284)|[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/8815149994)|[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/8155057510) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/7462504443) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/6569616388) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/5841518992) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/5332373278) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/4373178855) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/3655352317)|[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/3426806672)|[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/2977426178) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/2514847697) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/2014176911) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/2007977274) |[![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/1675861580) | [![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/1675861580) | [![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/1394488243) | [![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/1212617100) | [![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/998462546) | [![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/789405541) | [![Build status](https://github.com/HewlettPackard/oneview-golang/actions/workflows/ci.yml/badge.svg)](https://github.com/HewlettPackard/oneview-golang/actions/runs/638584153) |
## IntroductionHPE 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 Go SDK provides library to easily interact with HPE OneView. The HPE OneView Go SDK enables developers to easily build integrations and scalable solutions with HPE OneView.
You can find the latest supported HPE OneView Go SDK [here](https://github.com/HewlettPackard/oneview-golang/releases/latest)
## What's New
HPE OneView Go library extends support of the SDK to OneView REST API version 7000 (OneView v9.20)
Please refer to [notes](https://github.com/HewlettPackard/oneview-golang/blob/master/CHANGELOG.md) for more information on the changes , features supported and issues fixed in this version
### HPE Synergy Image Streamer
From Release 8.1, Image streamer is no longer supported.
## Getting Started
## Installation and Configuration
## Installation
HPE OneView SDK for Go can be installed from Source or Docker container installation methods. You can either use a docker container which will have the HPE OneView SDK for Go installed or perform local installation.### Docker Setup
The light weight containerized version of the HPE OneView SDK for Go is available in the [Docker Store](https://hub.docker.com/r/hewlettpackardenterprise/hpe-oneview-sdk-for-golang). The Docker Store image tag consist of two sections:```bash
# Download and store a local copy of oneview-golang and use it as a Docker Image.
$ docker pull hewlettpackardenterprise/hpe-oneview-sdk-for-golang:v9.2.0-OV9.2
# Run docker commands below given, which will in turn create a sh session
# where you can create files, issue commands and execute the examples.
$ docker run -it hewlettpackardenterprise/hpe-oneview-sdk-for-golang:v9.2.0-OV9.2 /bin/sh
```### Local Setup
- Local installation requires Installing Go
```bash
# Install the dependent packages
$ apt-get install build-essential git wget
$ wget https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz
``````bash
# untar with "tar -zxvf go1.15.2.linux-amd64.tar.gz"
# move go/ to /usr/local/
# mv go1.15.2.linux-amd64.tar.gz /usr/local/
# mkdir ~/go
``````bash
# Setting GO Environment Variable and adding the GO installed directory to PATH
$ export GOROOT=/usr/local/go
$ export GOPATH=$HOME/go
$ export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
``````go
# Install Oneview Go SDK
$ go get -u github.com/HewlettPackard/oneview-golang
```## Configuration
### Environment Variables
```bash
# Required
$ export ONEVIEW_OV_ENDPOINT=
$ export ONEVIEW_OV_USER=
$ export ONEVIEW_OV_PASSWORD=
$ export ONEVIEW_OV_DOMAIN=LOCAL
$ export ONEVIEW_SSLVERIFY=false
$ export ONEVIEW_APIVERSION=
```
Note: Currently this SDK supports OneView API 5200 minimally, where we can test OneView API 5200 version with this SDK. If API version is not provided then appliance's API version will be used. If API version used is not supported then error will be thrown.### OneView Client Configuration
The OneView Client configuration options that can be passed during OneView Client object creation:
```go
# Create a OneView client object:
import "github.com/HewlettPackard/oneview-golang/ov"var ClientOV *ov.OVClient
apiversion, _ := strconv.Atoi(os.Getenv("ONEVIEW_APIVERSION"))ovc := ClientOV.NewOVClient(
os.Getenv("ONEVIEW_OV_USER"), # This is to set the Oneview UserName
os.Getenv("ONEVIEW_OV_PASSWORD"), # This is to set the Oneview Password
os.Getenv("ONEVIEW_OV_DOMAIN"), # This is to set the Domain, default is LOCAL
os.Getenv("ONEVIEW_OV_ENDPOINT"), # This is to set the IP Address of the Oneview Appliance
false, # This is to set the SSL, default is false
apiversion, # This is to set OV REST API Version. Defaults to OneView Max supported REST API Version.
"*")
```:lock: Tip: Check the file permissions because the password is stored in clear-text.
### Configuration Files
Configuration files can also be used to define client configuration (json or yaml formats). Here's an example json file:
```json
# oneview_config.json
{
"username": "",
"password": "",
"endpoint": "",
"domain": "LOCAL",
"apiversion": "",
"sslverify": false,
"ifmatch": "*"
}
```and load via:
```go
# Create a OneView client object:
import "github.com/HewlettPackard/oneview-golang/ov"var ClientOV *ov.OVClient
config, _ := ov.LoadConfigFile("oneview_config.json")ovc := ClientOV.NewOVClient(
config.UserName, # This is to set the Oneview UserName
config.Password, # This is to set the Oneview Password
config.Domain, # This is to set the Domain, default is LOCAL
config.Endpoint, # This is to set the IP Address of the
config.SslVerify, # This is to set the SSL, default is false
config.ApiVersion, # This is to set OV REST API Version. Defaults to OneView Max supported REST API Version.
config.IfMatch)
```
:lock: Tip: Check the file permissions if the password or token is stored in clear-text.## API Implementation
A detailed list of the HPE OneView REST interfaces that have been implemented in this SDK can be found in the [endpoints-support.md](https://github.com/HewlettPackard/oneview-golang/blob/master/endpoints-support.md) file.
## Getting Help
Are you running into a road block? Have an issue with unexpected behavior? Feel free to open a new issue on the [issue tracker](https://github.com/HewlettPackard/oneview-golang/issues/new)
## License
This project is licensed under the Apache 2.0 license. Please see [LICENSE](LICENSE) for more info.## Contributing and feature requests
We welcome your contributions to the HPE OneView for Go SDK library.
**Contributing:** You know the drill. Fork it, branch it, change it, commit it, and pull-request it.
We are passionate about improving this project, and glad to accept help to make it better.
For more information refer [CONTRIBUTING.md](https://github.com/HewlettPackard/oneview-golang/blob/master/CONTRIBUTING.md) file.NOTE: We reserve the right to reject changes that we feel do not fit the scope of this project, so for feature additions, please open an issue to discuss your ideas before doing the work.
**Feature Requests:** If you have a need that is not met by the current implementation, please let us know opening an new enhancement request/issue.
This feedback is important for us to deliver a useful product.## Testing your changes
We use docker to build and test, run this project on a system that has docker. If you don't use docker, you will need to install and setup go-lang locally as well as any other make requirements.
You can use `USE_CONTAINER=false` environment setting for make to avoid using docker. Otherwise make sure to have these tools:
- docker client and daemon
- gnu make toolsThe Tests in GoLang are divided into two segments one is doing the acceptance test and another drives the Unit Tests.
#### With Docker
```
$ make test
```#### Without docker
* Install golang 1.5 or higher(We recommend using Go 1.15)
* Install go packages listed in .travis.ymlThe Test Data for these Tests are supplied through JSON file stored at `test/data for example config_EGSL_tb200.json`
These Tests can be run locally, you must install the below dependencies as mention in .travis.yml and do export USE_CONTAINER=false
```go
$ go get github.com/mattn/goveralls
$ go get -u golang.org/x/lint/golint
```These Tests are using make files to save the compile time. Below are the commands to run the tests.
```bash
$ sudo make vet
$ sudo make test-short
$ sudo make test-long
$ sudo make coverage-send
```Note: ```$ make test``` runs all the above mentioned tests.
## Additional Resources
### HPE OneView Documentation
[HPE OneView Release Notes](http://hpe.com/info/OneView/docs)
[HPE OneView Support Matrix](http://hpe.com/info/OneView/docs)
[HPE OneView Installation Guide](http://hpe.com/info/OneView/docs)
[HPE OneView User Guide](http://hpe.com/info/OneView/docs)
[HPE OneView Online Help](http://hpe.com/info/OneView/docs)
[HPE OneView REST API Reference](http://hpe.com/info/OneView/docs)
[HPE OneView Firmware Management White Paper](http://hpe.com/info/OneView/docs)
[HPE OneView Deployment and Management White Paper](http://hpe.com/info/OneView/docs)
### HPE OneView Community
[HPE OneView Community Forums](http://hpe.com/info/oneviewcommunity)
Learn more about HPE OneView at [hpe.com/info/oneview](https://hpe.com/info/oneview)