All Projects → HewlettPackard → oneview-golang

HewlettPackard / oneview-golang

Licence: Apache-2.0 license
Golang bindings for OneView api's

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to oneview-golang

oneview-sdk-ruby
This project is no longer being developed and has limited support. In the near future this repository will be fully deprecated. Please consider using other OneView projects, such as Golang and Python.
Stars: ✭ 13 (-40.91%)
Mutual labels:  infrastructure-as-code, hpe-oneview, oneview-api, hpe-image-streamer
oneview-chef
This project is no longer being developed and has limited support. In the near future this repository will be fully deprecated. Please consider using other OneView projects, such as Terraform and Ansible Collection
Stars: ✭ 16 (-27.27%)
Mutual labels:  hpe-oneview, oneview-api, hpe-image-streamer
POSH-HPEOneView
PowerShell language bindings library for HPE OneView.
Stars: ✭ 116 (+427.27%)
Mutual labels:  infrastructure-as-code, hpe-oneview
openshift-install-power
UPI Install helper to deploy OpenShift 4 on IBM Power Systems Virtual Server using Terraform IaC
Stars: ✭ 16 (-27.27%)
Mutual labels:  infrastructure-as-code
Nietzsche
Scrap quotes from Goodreads and schedule random tweets.
Stars: ✭ 44 (+100%)
Mutual labels:  infrastructure-as-code
spring-boot-template
Template for Spring Boot applications
Stars: ✭ 59 (+168.18%)
Mutual labels:  infrastructure-as-code
icp-ce-on-linux-containers
Multi node IBM Cloud Private Community Edition 3.2.x w/ Kubernetes 1.13.5 in a Box. Terraform, Packer and BASH based Infrastructure as Code script sets up a multi node LXD cluster, installs ICP-CE and clis on a metal or VM Ubuntu 18.04 host.
Stars: ✭ 52 (+136.36%)
Mutual labels:  infrastructure-as-code
ami-spec
Acceptance testing your AMIs
Stars: ✭ 47 (+113.64%)
Mutual labels:  infrastructure-as-code
actions
github actions stuff
Stars: ✭ 39 (+77.27%)
Mutual labels:  infrastructure-as-code
netris-operator
The Kubernetes Operator for Netris
Stars: ✭ 28 (+27.27%)
Mutual labels:  infrastructure-as-code
terraform-provider-upcloud
Terraform provider for UpCloud
Stars: ✭ 52 (+136.36%)
Mutual labels:  infrastructure-as-code
paco
Paco: Prescribed automation for cloud orchestration
Stars: ✭ 32 (+45.45%)
Mutual labels:  infrastructure-as-code
gotf
Managing multiple environments with Terraform made easy
Stars: ✭ 25 (+13.64%)
Mutual labels:  infrastructure-as-code
terraform-provider-oneview
Automates the provisioning of physical infrastructure from a private cloud using templates from HPE OneView with Terraform
Stars: ✭ 46 (+109.09%)
Mutual labels:  hpe-oneview
k3ai
A lightweight tool to get an AI Infrastructure Stack up in minutes not days. K3ai will take care of setup K8s for You, deploy the AI tool of your choice and even run your code on it.
Stars: ✭ 105 (+377.27%)
Mutual labels:  infrastructure-as-code
ggshield
Find and fix 360+ types of hardcoded secrets and 70+ types of infrastructure-as-code misconfigurations.
Stars: ✭ 1,272 (+5681.82%)
Mutual labels:  infrastructure-as-code
goss
Quick and Easy server testing/validation
Stars: ✭ 26 (+18.18%)
Mutual labels:  infrastructure-as-code
getting-into-consul
A zero to complete walk through of setting up HashiCorp Consul on AWS from scratch!
Stars: ✭ 56 (+154.55%)
Mutual labels:  infrastructure-as-code
Synergy-Binaries
Download the latest stable Synergy binaries.
Stars: ✭ 671 (+2950%)
Mutual labels:  synergy
telltime
iOS application to tell the time in the British way 🇬🇧⏰
Stars: ✭ 49 (+122.73%)
Mutual labels:  composable-architecture

HPE OneView SDK for GoLang

Build Status

OV Version 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 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
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 Go SDK provides library to easily interact with HPE OneView and HPE Image Streamer REST APIs. The HPE OneView Go SDK enables developers to easily build integrations and scalable solutions with HPE OneView and HPE Image Streamer.

You can find the latest supported HPE OneView Go SDK here

What's New

HPE OneView Go library extends support of the SDK to OneView REST API version 4600 (OneView v8.00)

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

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. The Docker Store image tag consist of two sections: <sdk_version-OV_version>

# Download and store a local copy of oneview-golang and use it as a Docker Image.
$ docker pull hewlettpackardenterprise/hpe-oneview-sdk-for-golang:v8.0.0-OV8.0
# 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:v8.0.0-OV8.0 /bin/sh

Local Setup

  • Local installation requires Installing Go
# Install the dependent packages
$ apt-get install build-essential git wget
$ wget https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz
# 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
# 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
# Install Oneview Go SDK
$ go get -u github.com/HewlettPackard/oneview-golang 

Configuration

Environment Variables

# Required
$ export ONEVIEW_OV_ENDPOINT=<ov_endpoint>
$ export ONEVIEW_OV_USER=<ov_username>
$ export ONEVIEW_OV_PASSWORD=<ov_password>
$ export ONEVIEW_OV_DOMAIN=LOCAL
$ export ONEVIEW_SSLVERIFY=false
$ export ONEVIEW_APIVERSION=<ov_apiversion>

Note: Currently this SDK supports OneView API 4600 minimally, where we can test OneView API 4600 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:

# 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.
    "*")                              

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

Image Streamer Client Configuration

The Image Streamer (I3S) client is very much similar to the OneView client, but has one key difference: it cannot generate it's own token. However, it uses the same token given to or generated by the OneView client, so if you need to generate a token, create a OneView client using a user & password, then pass the generated token into the Image Streamer client.

# Additional environment variable for I3S END POINT should be set.
$ export ONEVIEW_I3S_ENDPOINT=<i3s_endpoint>
# Create a OneView client object
import (
  "github.com/HewlettPackard/oneview-golang/ov"
  "github.com/HewlettPackard/oneview-golang/i3s" 
)

var (
  clientOV             *ov.OVClient
  i3sClient            *i3s.I3SClient
  endpoint             = os.Getenv("ONEVIEW_OV_ENDPOINT")
  i3sc_endpoint        = os.Getenv("ONEVIEW_I3S_ENDPOINT")
  username             = os.Getenv("ONEVIEW_OV_USER")
  password             = os.Getenv("ONEVIEW_OV_PASSWORD")
  domain               = os.Getenv("ONEVIEW_OV_DOMAIN")
)

apiversion, _ := strconv.Atoi(os.Getenv("ONEVIEW_APIVERSION"))
i3s_apiversion, _ := strconv.Atoi(os.Getenv("ONEVIEW_APIVERSION"))

# Creates OV Client
ovc := clientOV.NewOVClient( username, password, domain, endpoint, false, api_version, "*")

# Gets Session ID
ovc.RefreshLogin()

# Create I3s Client using Session ID
i3sc := i3sClient.NewI3SClient(i3sc_endpoint, false, i3s_apiversion, ovc.APIKey)

🔒 Tip: Check the file permissions because the password is stored in clear-text as Environment Variable.

Configuration Files

Configuration files can also be used to define client configuration (json or yaml formats). Here's an example json file:

# oneview_config.json
{
  "username":     "<ov_username>",  
  "password":     "<ov_password>",
  "endpoint":     "<ov_ip>",
  "domain":       "LOCAL",
  "apiversion":   "<ov_apiversion>",
  "sslverify":    false,
  "ifmatch":      "*"
}

and load via:

# 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)

🔒 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 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

License

This project is licensed under the Apache 2.0 license. Please see 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 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 tools

The 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.yml

The 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 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.

$ 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

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].