Giter VIP home page Giter VIP logo

oneview-golang's Introduction

HPE OneView SDK for GoLang

Build Status

OV Version 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.0.0 v8.9.0 v8.8.0 v8.7.0 v8.6.0 v8.5.0 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
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 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. 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

What's New

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

Please refer to notes 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. 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:v9.0.0-OV9.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:v9.0.0-OV9.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 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:

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

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

oneview-golang's People

Contributors

adarobin avatar akshith-gunasheelan avatar alisha-k-kalladassery avatar anushay1916 avatar asisbagga avatar bobfraser1 avatar bsoutham avatar chebroluharika avatar codelingobot avatar dh2mom247 avatar dileepds avatar falcosuessgott avatar harikachebrolu avatar jsmartt avatar jyothisgm avatar madhav-bharadwaj avatar mbfrahry avatar miqui avatar nabhajit-ray avatar pghpe avatar satyasreenivas avatar sfc-gh-eraigosa avatar shandcruz avatar soodpr avatar sowmyahsg avatar supreethpy avatar venkateshravula avatar yuvirani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oneview-golang's Issues

Use case for Notifications

Notifications could be useful for event based actions for OneView environment. What are our use cases for it? Shall we start by implementing the ability to read the notifications.

oneview_ethernet_network bug Terraform-Bug#306

Scenario/Intent

Various concurrent call over GetAll for GetByName fails.

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue] 6.2.0
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue] 6.2.0
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with] 6.1.0
  • OneView Client API Version: [API version of your client object] 2800
  • Golang Version: [Version of Golang in your environment] 1.13
  • Platform: [OS distribution and release version] Linux

Steps to Reproduce

Mutiple GetByName Calls through Terraform Sdk

Expected Result

Should work as is

Actual Result

Queries getting mixed between concurrent calls.

GetStorageVolumes() Unmarshal Error

Scenario/Intent
I am trying to call function GetStorageVolumes("", "") to get the StorageVolumesList

Environment Details
Golang binding for HPE OneView Version: v7.1.0
OneView SDK Version: 700
OneView Appliance Version: 6.50.00-0452161
OneView Client API Version: 3600
Golang Version: 1.18.2
Platform: Centos 7

Steps to Reproduce

func getStorageVolumes(client *ov.OVClient) (ov.StorageVolumesList, error) {
	storageVolumesList, err := client.GetStorageVolumes("", "")
	if err != nil {
		return ov.StorageVolumesList{}, err
	}
	return storageVolumesList, err
}

Expected Result
Storage Volumes list is returned as expected

Actual Result
json: cannot unmarshal string into Go struct field DeviceSpecificAttributes.members.deviceSpecificAttributes.id of type int

Travis build failed related to golint dependency

Travis build failed with the below error:
$ go get -u github.com/golang/lint/golint
package github.com/golang/lint/golint: code in directory /home/travis/gopath/src/github.com/golang/lint/golint expects import "golang.org/x/lint/golint"
The command "go get -u github.com/golang/lint/golint" failed and exited with 1 during .
Your build has been stopped.

Fix Docker Setup section in README.md

Scenario/Intent

Reading up the documentation to install docker container

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue]
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with]
  • OneView Client API Version: [API version of your client object]
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

-Not Applicable-

Steps to Reproduce

[What are the complete steps needed to do in order to reproduce your problem?]

Read https://github.com/HewlettPackard/oneview-golang/blob/master/README.md#docker-setup

Expected Result

[What do you expect to happen after taking the steps above?]

Expect the section to refer golang SDK and not Ruby SDK

Actual Result

[What actually happens after the steps above? Include error output or a link to a gist.]

From https://github.com/HewlettPackard/oneview-golang/blob/master/README.md#docker-setup

The light weight containerized version of the HPE OneView SDK for Ruby is available in the Docker Store. The Docker Store image tag consist of two sections: <sdk_version-OV_version>

  1. In the above statement, Ruby should be replaced with golang.
  2. In the above statement, the URL to Docker Store should point to golang container, and not the Ruby container.

Issues when running make test target locally

We should make the local desktop testing for this project easier. Currently we have to make with the following command locally, unless you clone the project perfectly:

USE_CONTAINER=true GH_USER=HewlettPackard GH_REPO=oneview-golang make test

Lets make using docker to build this project the default, so that requirements will now be:

  • docker
  • make

No need to have golang even installed. This should remove the requirement for USE_CONTAINER option, but we should still have the option so that the setting USE_CONTAINER=false is possible under travis builds, where we don't have docker.

If we always build in docker then we can assume that GH_USER can always be HewlettPackard and GH_REPO=oneview-golang can always be oneview-golang. This also improves local testing before submits.

Lets also fix how we call docker to include -e GH_REPO and -e GH_USER in the Makefile.

Selecting available machines should be atomic

When we look for available servers, we should be able to do multiple lookups in parallel and not get the same lookup on another machine. In particular, it appears that when we're creating a server profile, we first perform a power off , then create profile, but don't re-check if it's still an available server. A recheck to re-verify it's an available server should be made.

Query Parameter retains in the next endpoint call.

Query parameter retains in the next call for the object if it is not reset by passing some parameter.

eg:
get_all with query parameters
get_all without query parameters

The second call will have all the parameters that were in the first.

Need to be able to support larger #'s of servers, profiles, templates etc.

OneView automatically returns GET calls for resources in pages based on the "count" value requested or based on some level of internally determined size to assure a certain speed of response. See the "count" query parameter description in the API docs:

The number of resources to return. A count of -1 requests all the items. The actual number of items > in the response may differ from the requested count if the sum of start and count exceed the total > number of items, or if returning the requested number of items would take too long.

From testing a 2.0 DCS appliance we noted paging at the following boundaries:

  • 32 for server-hardware
  • 64 for server-profiles
  • 64 for server-profile-templates
  • 50 for index resources

ICsp is similar. Testing with ICsp 7.4 and 7.4.1 noted paging of OS build plans above 50 or 60.

At minimum the following files have API calls that don't account for paging:

  • ov/profiles.go
  • ov/profile-templates.go
  • ov/server-hardware.go
  • icsp/jobs.go
  • icsp/servers.go
  • icsp/build_plan.go

To workaround this every GET call needs to check nextPageUri in the response to see if additional GETs must be made to get the entire list. I worked around this in the CSA dynamic JSP files with the following subroutine wrapping every GET call where the value for query_url would start out with something like "/rest/server-hardware" and providerUrl was the part of the API call that goes before that (meaning https://):

JSONArray DoPagedGet (String providerUrl, String query_url, DefaultHttpClient client, String sessionID) throws Exception {
        String output = "";
        JSONArray fullMemberList = new JSONArray();

        while (!query_url.isEmpty()) {
            logger.debug("Doing paged query: " + query_url);
            output = OneView_Get(client, providerUrl+query_url, sessionID);

            JSONObject response_json = new JSONObject(output);
            int count = response_json.getInt("count");
            JSONArray currPageMembers = response_json.getJSONArray("members");
            logger.debug("Got " + count + " entries");

            for (int i = 0; i < currPageMembers.length(); i++) {
                fullMemberList.put(currPageMembers.getJSONObject(i));
            }
            String nextPage = response_json.getString("nextPageUri");
            query_url = "";
            if (nextPage != null && !nextPage.equalsIgnoreCase("null")) {
                logger.debug("Need to do query to get next page: " + nextPage);
                query_url = nextPage;
            }
        }
        return fullMemberList;
    }

LIG NTP Configuration.

Scenario/Intent

Need to fix LIG NTP Configuration.

Environment Details

  • Golang binding for HPE OneView Version:
  • OneView SDK Version: 1.7.0
  • OneView Appliance Version: 5.60
  • OneView Client API Version: 2400
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

Steps to Reproduce

Tried to Create LIG, results to error.

Expected Result

Should create/read LIG correctly

Actual Result

Throws error

Add server name to ServerHardware structure in server_hardware.go

Scenario/Intent

Add the server name to the ServerHardware structure in server_hardware.go

Environment Details

  • Golang binding for HPE OneView Version: 1.5.0
  • OneView SDK Version: 5.0
  • OneView Appliance Version: 5.0
  • OneView Client API Version: 1200
  • Golang Version: go1.14.4 windows/amd64
  • Platform: Windows 10

Steps to Add the Change

  • Added after the Category entry
type ServerHardware struct {
	ServerHardwarev200
	AssetTag              string        `json:"assetTag,omitempty"`    // "assetTag": "[Unknown]",
	Category              string        `json:"category,omitempty"`    // "category": "server-hardware",
        ServerName          string        `json:"servername,omitempty"`  // "category": "server-hardware",

Expected Result

The server name will be available in the server hardware list output

iscis_initiator_name is not part of spt

Scenario/Intent

[What are you trying to achieve but can't?]

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue]
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with]
  • OneView Client API Version: [API version of your client object]
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

Steps to Reproduce

[What are the complete steps needed to do in order to reproduce your problem?]

Expected Result

[What do you expect to happen after taking the steps above?]

Actual Result

[What actually happens after the steps above? Include error output or a link to a gist.]

server profile creation does not work against template #235

Scenario/Intent

Create server profile without assigning hardware.
This issue is raised to fix
HewlettPackard/terraform-provider-oneview#235

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue]
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with]
  • OneView Client API Version: [API version of your client object]
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

Steps to Reproduce

[What are the complete steps needed to do in order to reproduce your problem?]

Expected Result

[What do you expect to happen after taking the steps above?]

Actual Result

[What actually happens after the steps above? Include error output or a link to a gist.]

Broken Acceptance Tests

  1. ov/api_version_test:52 Should be true

  2. ov/logical_interconnect_group_test:197 The "type" field content, "logical-interconnect-groupV3", included in this request is invalid.\n Response Status: 400 Bad Request"

  3. ov/logical_interconnect_group_test:245 Not equal: "go LIG test" (expected) != "" (actual)
    //Because of 2

  4. ov/logical_switch_group_test:62 400 Bad Request

  5. ov/logical_switch_group_test:115 Not equal: "test logical switch group" (expected) != "" (actual)
    //Because of 4

6)ov/power_state_test:30 404 Not Found

  1. ov/power_state_test:31 Not equal

  2. ov/power_state_test:36 Not equal

  3. ov/profile_templates_test:70 "goTestSPT" (expected) != "" (actual) //make sure it's actually being created

  4. ov/profiles_test:96 Not equal: "wenlock-machine-1" (expected) != "" (actual)

  5. ov/profiles_test:134 "Error connection not found on server profile, please try a different connection name."
    //Because of 10

  6. ov/profiles_test:135 Not equal: "AA:43:83:10:00:BA" (expected) != "null" (actual)
    //Because of 10

  7. ov/profiles_test:157 Not equal: "VCGM123023" (expected) != "null" (actual)
    //Because of 10

  8. ov/server_hardware_test:30 404 not found

  9. ov/server_hardware_test:32 "VCGM123023" (expected) != "null" (actual)
    //Because of 14

  10. ov/server_hardware_test:53 "Error! No available blades that are compatible with the server profile!"

  11. ov/server_hardware_test:57 Should not be: ""

  12. ov/server_hardware_test:79 404 not found

  13. icsp/icsp_test:180 Error interface slotid not found please try another interface id."

  14. icsp/icsp_test:181 "AA:43:83:10:00:BB" (expected) != "" (actual)
    //Because of 19

  15. icsp/icsp_test:184 404 not found

  16. icsp/icsp_test:186 404 not found

  17. icsp/icsp_test:194 public_interface for VCGM123023 Should have a value
    //Because of 22

  18. icsp/icsp_test:242 404 not found

  19. icsp/icsp_test:296 404 not found

  20. icsp/netwconfig_test:142 404 not found

  21. icsp/servers_test:36 "Error public_interface custom attribute is not found."

  22. icsp/servers_test:38 Should return an ip address string
    // Because of 27

  23. icsp/servers_test:79 "Error interface not found, please try a different mac address."

30 icsp/servers_test:80 "AA:43:83:10:00:BB" (expected) != "" (actual)
// Because of 29

  1. icsp/servers_test:120 Failed to get a valid list of interfaces -> []
    // Because of 29

  2. icsp/servers_test:174 "Error interface slotid not found please try another interface id."

  3. icsp/servers_test:175 Failed to get a an interface name
    // Because of 32

  4. icsp/servers_test:179 Error interface slotid not found
    // Because of 32

  5. icsp/servers_test:180 Failed to get interface name
    // Because of 32

  6. icsp/servers_test:221 404 Not Found

  7. icsp/servers_test:269 "IC04-HOUEGSL-C7000-04-4" (expected) != "" (actual)
    // Because of 36

  8. icsp/servers_test:325 Should be true

  9. icsp/servers_test:326 500 server error

  10. icsp/servers_test:348 Should be true

  11. icsp_servers_test:372 404 not found

CreateProfileFromTemplate not working w OV 5.20

Scenario/Intent

CreateProfileFromTemplate

Environment Details

  • **Golang binding for HPE OneView Version: go version go1.13.11 linux/amd64
  • **OneView SDK Version: latest
  • **OneView Appliance Version: 5.20
  • **OneView Client API Version:1600
  • **Golang Version:go version go1.13.11 linux/amd64
  • **Platform:linux

Steps to Reproduce

package main

import (
"fmt"
"github.com/HewlettPackard/oneview-golang/ov"
//"github.com/HewlettPackard/oneview-golang/utils"
"os"
)

func main() {
var (
ClientOV *ov.OVClient
template_name = "ANSIBLE_OS_Deploy_via_iLO"
profile_name = "Roundtable - API Demo Server"
blade = "CTC H5 HE21, bay 1"

)
ovc := ClientOV.NewOVClient(
    os.Getenv("ONEVIEW_OV_USER"),
    os.Getenv("ONEVIEW_OV_PASSWORD"),
    os.Getenv("ONEVIEW_OV_DOMAIN"),
    os.Getenv("ONEVIEW_OV_ENDPOINT"),
    false,
    1600,
    "")
    
//sort := "name:desc"


spt, err := ovc.GetProfileTemplateByName(template_name)
//fmt.Println(spt)
if err != nil {
    fmt.Println("Server Profile Template Retrieval By Name Failed: ", err)
} else {
    serverName, err := ovc.GetServerHardwareByName(blade)
    if err != nil {
        fmt.Println("Failed to fetch server hardware name: ", err)
    } else {
        err = ovc.CreateProfileFromTemplate(profile_name, spt, serverName)
        if err != nil {
            fmt.Println("Server Profile Create Failed: ", err)
        } else {
            fmt.Println("#----------------Server Profile Created---------------#")
        }
    }
}

}

Output:

Initializing creation of server profile for Roundtable - API Demo Server.
Error submitting new profile request: Error in response: Invalid JSON type.
Response Status: 400 Bad Request
Response Details: The "type" field content, "ServerProfileTemplateV8", included in this request is not valid.
Server Profile Create Failed: Error in response: Invalid JSON type.
Response Status: 400 Bad Request
Response Details: The "type" field content, "ServerProfileTemplateV8", included in this request is not valid.

Expected Result

SP created

Actual Result

Initializing creation of server profile for Roundtable - API Demo Server.
Error submitting new profile request: Error in response: Invalid JSON type.
Response Status: 400 Bad Request
Response Details: The "type" field content, "ServerProfileTemplateV8", included in this request is not valid.
Server Profile Create Failed: Error in response: Invalid JSON type.
Response Status: 400 Bad Request
Response Details: The "type" field content, "ServerProfileTemplateV8", included in this request is not valid.

Workaround:
add lines:
} else if c.APIVersion == 1600 {
new_template.Type = "ServerProfileV12"
in profiles.go" line 325; /usr/lib/golang/src/github.com/HewlettPackard/oneview-golang/ov

Test Issue

Scenario/Intent

[What are you trying to achieve but can't?]

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue]
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with]
  • OneView Client API Version: [API version of your client object]
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

Steps to Reproduce

[What are the complete steps needed to do in order to reproduce your problem?]
This is a test issue

Expected Result

[What do you expect to happen after taking the steps above?]

Actual Result

[What actually happens after the steps above? Include error output or a link to a gist.]

server profile description is not part of server profile

Scenario/Intent

[Create server profile from server profile template?]

Environment Details

  • Golang binding for HPE OneView Version: []
  • OneView SDK Version: [6.60]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with]
  • OneView Client API Version: [3800]
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

Steps to Reproduce

[1. Create spt with server profile description field populated.
2. Use that spt to create the Server profile]

Expected Result

[Server profile creation should be succesful]

Actual Result

[Got error saying "Server profile description is not part server profile]

Getting 403 while running examples

Scenario/Intent

[What are you trying to achieve but can't?]
Trying to run the examples like:

go run server_hardware.go
It returns:

Failed to fetch server List : Error in response: Forbidden
Response Status: 403 Forbidden
Response Details: You are not allowed to access the requested resource.
exit status 1

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue]
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with]
  • OneView Client API Version: [API version of your client object]
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

Using master code
OneView API Version: 1400
Platform: Ubuntu 18.04
Go version: go version go1.14.2 linux/amd64

Steps to Reproduce

[What are the complete steps needed to do in order to reproduce your problem?]

export env variables
run any sample example program

Expected Result

[What do you expect to happen after taking the steps above?]
If I run server_hardware.go, I would expect server list object

Actual Result

[What actually happens after the steps above? Include error output or a link to a gist.]
See above failure message

GetServerHardwareList only returns 32 Servers or panics

Scenario/Intent

ovc.GetServerHardwareList(filters, "", "", "", "") only returns 32 Servers

Environment Details

  • Golang binding for HPE OneView Version: 1.80

Steps to Reproduce

Use the serverhardware.go example from the repo against an appliance with more then 32 servers

Expected Result

getting all servers like it will be done with Powershell or Python.
curl itself also does only get the first 32 entries.
Please refer to count value and nextpageURI
HPE internally discussed here: https://web.yammer.com/main/threads/eyJfdHlwZSI6IlRocmVhZCIsImlkIjoiMTExMjk1NTY5NjYxOTUyMCJ9

Actual Result

panic: runtime error: index out of range [32] with length 32

goroutine 1 [running]:
github.com/HewlettPackard/oneview-golang/ov.(*OVClient).GetServerHardwareList(0xc0000cc000, 0xc0000134c0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/skoch/go/src/github.com/HewlettPackard/oneview-golang/ov/server_hardware.go:302 +0xac5
main.main()
/home/skoch/serverhw.go:25 +0x23b
exit status 2

LIG Qos Attribute Issue

Scenario/Intent

To update LIG

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue] 6.0.0
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with] 6.0
  • OneView Client API Version: [API version of your client object] 2600
  • Golang Version: [Version of Golang in your environment] 1.13
  • Platform: [OS distribution and release version] ubuntu

Steps to Reproduce

Do a GetByName on LIG
change the name of the LIG
and Update it

Expected Result

Should update LIG

Actual Result

Throws "The QoS configuration is not valid. Disabled class RoCE lossless must not have any ingress mapping. Enable the traffic class and retry." errors

GetIloIPAddress() does not work with GetServerHardwareList()

I'm trying to get the ILO IP addresses for all servers returned by GetServerHardwareList()

Using:# go version
go version go1.15.6 linux/amd64
OneView Client API Version: 2000

GetIloIPAddress() works with GetServerHardwareByName() because it sets the Client member:

    serverHardwareList.Members[0].Client = c

GetServerHardwareList() does not set the Client member for each server, leaving it as nil, so GetIloIPAddress() panics:

For example, these will panic in GetIloIPAddress() because the Client member is not set:

    filters := []string{""}
    ServerList, err := ovc.GetServerHardwareList(filters, "", "", "", "")
    for i := 0; i < ServerList.Total; i++ {
            iloIpaddress := ServerList.Members[i].GetIloIPAddress()
    }

OR

    filters := []string{""}
    ServerList, err := ovc.GetServerHardwareList(filters, "", "", "", "")
   for _, serverName := range ServerList.Members {
            iloIpaddress := serverName.GetIloIPAddress()
    }

I can workaround it by setting the Client member before using GetIloIPAddress() but it would be better to have it set in GetServerHardwareList():

This will display all the server ILO IP addresses returned by GetServerHardwareList():

    filters := []string{""}
    ServerList, err := ovc.GetServerHardwareList(filters, "", "", "", "")
    for i := 0; i < ServerList.Total; i++ {
            ServerList.Members[i].Client = ovc
    }
    for i := 0; i < ServerList.Total; i++ {
            iloIpaddress := ServerList.Members[i].GetIloIPAddress()
    }

Building DockerImage fails with the current Go version

Trying to build the image results in below error:
Step 1/6 : FROM golang:1.6.2

---> 8ecba0e9bd48

Step 2/6 : RUN go get github.com/golang/lint/golint github.com/mattn/goveralls golang.org/x/tools/cover github.com/tools/godep github.com/aktau/github-release

---> Running in 44f55cfe816c

�[91m# golang.org/x/tools/go/internal/gcimporter
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:90: undefined: io.SeekCurrent
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:93: undefined: io.SeekCurrent
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:169: undefined: io.SeekCurrent
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:200: r.declReader.Reset undefined (type bytes.Reader has no field or method Reset)
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:239: r.declReader.Reset undefined (type bytes.Reader has no field or method Reset)
�[0m
�[91m# github.com/aktau/github-release
src/github.com/aktau/github-release/cmd.go:96: enc.SetIndent undefined (type *json.Encoder has no field or method SetIndent)
�[0m
Removing intermediate container 44f55cfe816c

The command '/bin/sh -c go get github.com/golang/lint/golint github.com/mattn/goveralls golang.org/x/tools/cover github.com/tools/godep github.com/aktau/github-release' returned a non-zero code: 2

Solution: Can be fixed by upgrading the Go version from 1.6.2 to 1.10.4

3.0 OneView compatability

When doing a new deploy on 30 API we get this error:

REQ --> &{Method:POST URL:https://10.0.10.118/rest/server-profiles?filter=serverHardwareTypeUri%3D%27%2Frest%2Fserver-hardware-types%2FD086A170-DF72-4D4C-BFE8-40B2BAEA1A2E%27&filter=serverGroupUri%3D%27%2Frest%2Fenclosure-groups%2F70536257-794b-4349-917a-59e5ddc60d39%27&sort=name%3Aasc Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Auth:[LTE5MDc1ODE3MzI0jsJqmR7sWGgggEJxmX3ZaR_7A1FHCzKz] Content-Type:[application/json; charset=utf-8] X-Api-Version:[300]] Body:{Reader:} ContentLength:1719 TransferEncoding:[] Close:false Host:10.0.10.118 Form:map[] PostForm:map[] MultipartForm: Trailer:map[] RemoteAddr: RequestURI: TLS:}

RESP --> &{Status:400 Bad Request StatusCode:400 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Via:[1.1 example.com] Cache-Control:[no-cache] Date:[Thu, 19 Nov 2015 17:58:41 GMT] Server:[Apache] Content-Type:[application/json;charset=UTF-8]] Body:0x129bbd40 ContentLength:-1 TransferEncoding:[chunked] Close:true Trailer:map[] Request:0x12974700 TLS:0x12a9a7c0}

ERROR -->

Error submitting new profile request: Error in response: The field named StorageTargetType near line 1, column 1,697 is not a valid field in this JSON object.
Response Status: 400 Bad Request

Inconsistency in uplink set struct

Scenario/Intent

Adding support for resource uplink sets in terraform.

Environment Details

  • Golang binding for HPE OneView Version: 1.0.0
  • **OneView Appliance Version:**4.10
  • OneView Client API Version: 800
  • Golang Version: 1.11.2
  • Platform: ubuntu

Steps to Reproduce

Run uplink sets resource in terraform. (newly created, not in master yet. But can be found in the branch uplink_sets)

Expected Result

Build successfully

Actual Result

Build fails as the uplink set struct has the below inconsistency:

  1. The type of the attribute description should be string but is defined as utils.Nstring

Another issue found as per the API doc:

  1. the struct ExpectedNeighbor should be part of the PortConfigInfos struct.

Test

Scenario/Intent

[What are you trying to achieve but can't?]

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue]
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with]
  • OneView Client API Version: [API version of your client object]
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

Steps to Reproduce

[What are the complete steps needed to do in order to reproduce your problem?]

Expected Result

[What do you expect to happen after taking the steps above?]

Actual Result

[What actually happens after the steps above? Include error output or a link to a gist.]

Test issue1

Scenario/Intent

[What are you trying to achieve but can't?]

Environment Details

  • Golang binding for HPE OneView Version: [Version of this module for which you are encountering the issue]
  • OneView SDK Version: [Version of the Oneview SDK for which you are encountering the issue]
  • OneView Appliance Version: [Version of the OneView appliance you're interacting with]
  • OneView Client API Version: [API version of your client object]
  • Golang Version: [Version of Golang in your environment]
  • Platform: [OS distribution and release version]

Steps to Reproduce

[What are the complete steps needed to do in order to reproduce your problem?]

Expected Result

[What do you expect to happen after taking the steps above?]

Actual Result

[What actually happens after the steps above? Include error output or a link to a gist.]

OaBayCount returned value is 0

Scenario/Intent

Using GetEnclosureByName, the return value for OaBayCount is 0

Environment Details

  • Golang binding for HPE OneView Version: Latest/Master
  • OneView SDK Version:
  • OneView Appliance Version: 4.10
  • OneView Client API Version: 800
  • Golang Version: 1.11.4
  • Platform: Windows 10

Steps to Reproduce

Using the OneView 4.10 Simulator,

I have the following code:

package main

import (
"fmt"

"github.com/HewlettPackard/oneview-golang/ov"

)

func main() {

// Connect
var (
	clientOV *ov.OVClient
)
ovc := clientOV.NewOVClient("Administrator", "password", "", "https://192.168.1.15", false, 600, "*")

// Get Enclosure List
enclist, _ := ovc.GetEnclosures("", "", "", "", "")

// Get Detail of each Enclosure
for i := 0; i < len(enclist.Members); i++ {
	enc, _ := ovc.GetEnclosureByName(enclist.Members[i].Name)
	fmt.Println(enc.SerialNumber)
	fmt.Println("OA  Count: ", enc.OaBayCount)
	fmt.Println("IC  Count: ", enc.InterconnectBayCount)
	fmt.Println("Bay Count: ", enc.DeviceBayCount)
	fmt.Println("OA  Lenght:", len(enc.OA))
	fmt.Println("VC  Lenght:", len(enc.InterconnectBays))
	fmt.Println("Bay Lenght:", len(enc.DeviceBays))
	fmt.Println()
}

}

The output is this code is:

SGH100X6J1
OA Count: 0
IC Count: 8
Bay Count: 16
OA Lenght: 0
VC Lenght: 8
Bay Lenght: 16

SGH102X6J1
OA Count: 0
IC Count: 8
Bay Count: 16
OA Lenght: 0
VC Lenght: 8
Bay Lenght: 16

Expected Result

enc.OaBayCount = 2
len(enc.OA) = 2

Actual Result

OaBayCount = 0
Also, OAMAP is reporting 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.