Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mod ification #427

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.11
FROM golang:1.23

ENV USER root
WORKDIR /go/src/github.com/HewlettPackard/oneview-golang
Expand Down
20 changes: 0 additions & 20 deletions glide.lock

This file was deleted.

18 changes: 0 additions & 18 deletions glide.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module github.com/HewlettPackard/oneview-golang

go 1.22.1

require (
github.com/docker/machine v0.16.2
github.com/stretchr/testify v1.10.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/machine v0.16.2 h1:jyF9k3Zg+oIGxxSdYKPScyj3HqFZ6FjgA/3sblcASiU=
github.com/docker/machine v0.16.2/go.mod h1:I8mPNDeK1uH+JTcUU7X0ZW8KiYz0jyAgNaeSJ1rCfDI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
7 changes: 4 additions & 3 deletions icsp/servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ func (s Server) GetInterfaceFromMac(mac string) (Interface, error) {
}

// GetPublicIPV4 returns the public ip interface
// usually called after an os build plan is applied
//
// usually called after an os build plan is applied
func (s Server) GetPublicIPV4() (string, error) {
var position int
position, inetItem := s.GetValueItem("public_ip", "server")
Expand Down Expand Up @@ -552,7 +553,7 @@ func (c *ICSPClient) GetServerByName(name string) (Server, error) {
return srv, nil
}

//GetServerByHostName use the server hostname automatically assigned to get the server
// GetServerByHostName use the server hostname automatically assigned to get the server
func (c *ICSPClient) GetServerByHostName(hostname string) (Server, error) {
var (
servers ServerList
Expand Down Expand Up @@ -580,7 +581,7 @@ func (c *ICSPClient) GetServerByHostName(hostname string) (Server, error) {
return srv, nil
}

//GetServerBySerialNumber use the serial number to find the server
// GetServerBySerialNumber use the serial number to find the server
func (c *ICSPClient) GetServerBySerialNumber(serial string) (Server, error) {
var (
servers ServerList
Expand Down
4 changes: 2 additions & 2 deletions ov/logical_interconnect_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ type DcbxEtsPort struct {
PortName string `json:"portName,omitempty"` // "portName": "",
}

//portFlapProtection added in OV 2400
// portFlapProtection added in OV 2400
type PortFlapProtection struct {
Category utils.Nstring `json:"category,omitempty"` // "category": "snmp-configuration",
ConsistencyChecking string `json:"consistencyChecking,omitempty"` // "consistencyChecking":"ExactMatch"
Expand All @@ -304,7 +304,7 @@ type PortFlapProtection struct {

}

//TODO SNMPConfiguration
// TODO SNMPConfiguration
type SnmpConfiguration struct {
Category utils.Nstring `json:"category,omitempty"` // "category": "snmp-configuration",
ConsistencyChecking string `json:"consistencyChecking,omitempty"` // "created": "20150831T154835.250Z",
Expand Down
2 changes: 1 addition & 1 deletion ov/logical_switch_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/docker/machine/libmachine/log"
)

//TODO change this struct to hold the variables from the GET API response body variables
// TODO change this struct to hold the variables from the GET API response body variables
type LogicalSwitchGroup struct {
Category string `json:"category,omitempty"` // "category": "logical-switch-groups",
Created string `json:"created,omitempty"` // "created": "20150831T154835.250Z",
Expand Down
13 changes: 7 additions & 6 deletions ov/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type LocalStorageOptions struct { // "localStorage": {
}

// StoragePath storage path host-to-target paths
//Use GET /rest/storage-systems/{arrayid}/managedPorts?query="expectedNetworkUri EQ '/rest/fc-networks/{netowrk-id}'"
//to retrieve the storage targets for the associated network.
// Use GET /rest/storage-systems/{arrayid}/managedPorts?query="expectedNetworkUri EQ '/rest/fc-networks/{netowrk-id}'"
// to retrieve the storage targets for the associated network.
type StoragePath struct {
ConnectionID int `json:"connectionId,omitempty"` // connectionId (required), The ID of the connection associated with this storage path. Use GET /rest/server-profiles/available-networks to retrieve the list of available networks.
IsEnabled bool `json:"isEnabled"` // isEnabled (required), Identifies whether the storage path is enabled.
Expand Down Expand Up @@ -117,10 +117,11 @@ type SanSystemCredential struct {

// SanStorageOptions specify san storage
// No San
// "sanStorage": {
// "volumeAttachments": [],
// "manageSanStorage": false
// },
//
// "sanStorage": {
// "volumeAttachments": [],
// "manageSanStorage": false
// },
type SanStorageOptions struct { // sanStorage
ComplianceControl string `json:"complianceControl,omitempty"` // complianceControl
HostOSType string `json:"hostOSType,omitempty"` // hostOSType(required), The operating system type of the host. To retrieve the list of supported host OS types, issue a REST Get request using the /rest/storage-systems/host-types API.
Expand Down
30 changes: 15 additions & 15 deletions test/icsp/icsp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/HewlettPackard/oneview-golang/icsp"
)

//TODO: need to learn a better way of how integration testing works with bats
// TODO: need to learn a better way of how integration testing works with bats
// and use that instead
// Acceptance test
// 1) craete an environment, /.oneview.env, script to export these values:
Expand All @@ -25,15 +25,15 @@ import (
// ONEVIEW_ICSP_USER=user
// ONEVIEW_ICSP_DOMAIN=LOCAL
// ONEVIEW_SSLVERIFY=true
// 2) setup gotest container
// docker run -it --env-file ./.oneview.env -v $(pwd):/go/src/github.com/docker/machine --name testicsp docker-machine
// exit
// docker start goaccept
// 3) setup alias:
// alias testicsp='docker exec goaccept godep go test -test.v=true --short'
// 4) to refresh env options, use
// docker rm -f testicsp
// ... repeat steps 2
// 2. setup gotest container
// docker run -it --env-file ./.oneview.env -v $(pwd):/go/src/github.com/docker/machine --name testicsp docker-machine
// exit
// docker start goaccept
// 3. setup alias:
// alias testicsp='docker exec goaccept godep go test -test.v=true --short'
// 4. to refresh env options, use
// docker rm -f testicsp
// ... repeat steps 2
type ICSPTest struct {
Tc *testconfig.TestConfig
Client *icsp.ICSPClient
Expand Down Expand Up @@ -95,7 +95,7 @@ func getTestDriverU() (*ICSPTest, *icsp.ICSPClient) {
}

// implement create server unt test
//TODO: This test requires a server profile to have been created
// TODO: This test requires a server profile to have been created
func TestCreateServer(t *testing.T) {
var (
d *ICSPTest
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestInterface(t *testing.T) {
}

// TestPreApplyDeploymentJobs - setup some information from icsp
//TODO: This test requires a server profile to have been created
// TODO: This test requires a server profile to have been created
func TestPreApplyDeploymentJobs(t *testing.T) {
var (
d *ICSPTest
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestPreApplyDeploymentJobs(t *testing.T) {

// integrated acceptance test
// TestSaveServer implement save server
//TODO: a workaround to figuring out how to bubble up public ip address information from the os to icsp after os build plan provisioning
// TODO: a workaround to figuring out how to bubble up public ip address information from the os to icsp after os build plan provisioning
// @docker_user@ "@public_key@" @docker_hostname@ "@proxy_config@" "@proxy_enable@" "@interface@"
func TestApplyDeploymentJobs(t *testing.T) {
var (
Expand Down Expand Up @@ -262,8 +262,8 @@ func TestApplyDeploymentJobs(t *testing.T) {
}
}

//TestPostApplyDeploymentJobs test job Task
//TODO: This test requires a server profile to have been created
// TestPostApplyDeploymentJobs test job Task
// TODO: This test requires a server profile to have been created
func TestPostApplyDeploymentJobs(t *testing.T) {
var (
d *ICSPTest
Expand Down
2 changes: 1 addition & 1 deletion test/icsp/netconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestNewNetConfig(t *testing.T) {

// TODO TestNewNetConfigInterface - verify we can create an interface type

//TestNetConfigAddAllDHCP - verify we can convert a servers interfaces to dhcp
// TestNetConfigAddAllDHCP - verify we can convert a servers interfaces to dhcp
func TestNetConfigAddAllDHCP(t *testing.T) {
var (
d *ICSPTest
Expand Down
2 changes: 1 addition & 1 deletion test/icsp/servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func TestGetServerBySerialNumber(t *testing.T) {
}
}

//TODO: implement test for delete
// TODO: implement test for delete
func TestDeleteServer(t *testing.T) {
var c *icsp.ICSPClient
if os.Getenv("ICSP_TEST_ACCEPTANCE") == "true" {
Expand Down
20 changes: 10 additions & 10 deletions test/ov/ov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/HewlettPackard/oneview-golang/ov"
)

//TODO: need to learn a better way of how integration testing works with bats
// TODO: need to learn a better way of how integration testing works with bats
// and use that instead
// Acceptance test
// 1) craete an environment, /.oneview.env, script to export these values:
Expand All @@ -19,15 +19,15 @@ import (
// ONEVIEW_OV_USER=user
// ONEVIEW_OV_DOMAIN=LOCAL
// ONEVIEW_SSLVERIFY=true
// 2) setup gotest container
// docker run -it --env-file ./.oneview.env -v $(pwd):/go/src/github.com/docker/machine --name goaccept docker-machine
// exit
// docker start goaccept
// 3) setup alias:
// alias goaccept='docker exec goaccept godep go test -test.v=true --short'
// 4) to refresh env options, use
// docker rm -f goaccept
// ... repeat steps 2
// 2. setup gotest container
// docker run -it --env-file ./.oneview.env -v $(pwd):/go/src/github.com/docker/machine --name goaccept docker-machine
// exit
// docker start goaccept
// 3. setup alias:
// alias goaccept='docker exec goaccept godep go test -test.v=true --short'
// 4. to refresh env options, use
// docker rm -f goaccept
// ... repeat steps 2
type OVTest struct {
Tc *testconfig.TestConfig
Client *ov.OVClient
Expand Down
24 changes: 13 additions & 11 deletions testconfig/testcases.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ import (

// test case objects
// { "name" : "PROTEST",
// "cases": [
// {
// "name": "TestName1", // function name of the test case
// "enabled": true, // flag to determine if we do the test case or skip
// "TestData" : map[string][interface{ }] // list of test data by name
// "ExpectsData" : map[string][interface{}] // expects results
// },
// {
// ....
// },
//
// "cases": [
// {
// "name": "TestName1", // function name of the test case
// "enabled": true, // flag to determine if we do the test case or skip
// "TestData" : map[string][interface{ }] // list of test data by name
// "ExpectsData" : map[string][interface{}] // expects results
// },
// {
// ....
// },
//
// ]
//}
// }
type TestCases struct {
Name string `json:"name,omitempty"`
Enabled bool `json:"enabled,omitempty"`
Expand Down
18 changes: 10 additions & 8 deletions testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ import (
"github.com/docker/machine/libmachine/log"
)

//
// test case objects
// see testcases.go for test case methods
//
// see testcases.go for test case methods
//
// { "name" : "PROTEST",
// "cases": [
// {
// ...
// },
//
// "cases": [
// {
// ...
// },
//
// ]
//}
// }
type TestConfig struct {
Cases []TestCases `json:"cases,omitempty"` // "cases":[]
Name string `json:"name,omitempty"` // "name": "PROTEST",
Expand Down Expand Up @@ -49,7 +52,6 @@ func (tc *TestConfig) UnMarshallTestingConfig(json_data []byte) {
// log.Infof("tc compare s -> %s\n", tc.EqualFaceS(tc.GetExpectsData("TestGetAPIVersion", "FakeData"), "foo"))
// log.Infof("get no test data -> %+v \n", tc.GetTestData("TestGetAPIVersion", "Surprise"))
// log.Infof("is test enabled -> %+v \n", tc.IsTestEnabled("TestGetAPIVersion"))
//
func (tc *TestConfig) GetTestingConfiguration(config_name string) {
var (
package_root string
Expand Down
3 changes: 2 additions & 1 deletion utils/stringy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ func StringRemoveJSON(s string) string {
}

// StringGetJSON - just get the JSON from the string
// should only find the first json
//
// should only find the first json
func StringGetJSON(s string) string {
a := reGetJSON.FindStringSubmatch(s)
if len(a) > 2 {
Expand Down
22 changes: 0 additions & 22 deletions vendor/github.com/davecgh/go-spew/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions vendor/github.com/davecgh/go-spew/.travis.yml

This file was deleted.

Loading
Loading