Skip to content

Commit

Permalink
Merge pull request #31 from Cray-HPE/CASMHMS-5548
Browse files Browse the repository at this point in the history
Change HSM v1 references to v2 in MEDS
  • Loading branch information
alvarez3-hpe authored Jul 6, 2022
2 parents cec0888 + f414171 commit 5fb6135
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.18.0
1.19.0
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [1.19.0] - 2022-07-06

### Changed

- Change HSM v1 API references to v2

## [1.18.0] - 2022-03-07

### Removed
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# (C) Copyright [2019-2021] Hewlett Packard Enterprise Development LP
# (C) Copyright [2019-2022] Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -55,7 +55,7 @@ LABEL maintainer="Hewlett Packard Enterprise"
STOPSIGNAL SIGTERM

# Setup environment variables.
ENV HSM_URL=https://api-gateway.default.svc.cluster.local/apis/smd/hsm/v1
ENV HSM_URL=https://api-gateway.default.svc.cluster.local/apis/smd/hsm/v2
ENV MEDS_OPTS=""

ENV VAULT_ADDR="http://cray-vault.vault:8200"
Expand Down
10 changes: 5 additions & 5 deletions cmd/meds/meds.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* (C) Copyright [2019-2021] Hewlett Packard Enterprise Development LP
* (C) Copyright [2019-2022] Hewlett Packard Enterprise Development LP
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -952,7 +952,7 @@ func init_cabinet(cab GenericHardware) error {
log.Println("Failed to get ethernet interfaces from HSM, not processing further: ", err)
return err
}
hsmEthernetInterfacesMap := map[string]sm.CompEthInterface{}
hsmEthernetInterfacesMap := map[string]sm.CompEthInterfaceV2{}
for _, ei := range hsmEthernetInterfaces {
hsmEthernetInterfacesMap[ei.ID] = ei
}
Expand All @@ -969,7 +969,7 @@ func init_cabinet(cab GenericHardware) error {
}

// Preload HSM EthernetInterfaces with the endpoints.
ethernetInterface := sm.CompEthInterface{
ethernetInterface := sm.CompEthInterfaceV2{
MACAddr: normalizedMAC,
CompID: v.name,
}
Expand Down Expand Up @@ -1148,8 +1148,8 @@ func main() {
"Default SSH key to use when communicating with targets")
flag.StringVar(&sls, "sls", "http://cray-sls/v1",
"Location of the System Layout Service API, up through the /v1 portion. (Do not include trailing slash)")
flag.StringVar(&hsm, "hsm", "http://cray-smd/hsm/v1",
"Location of the Hardware State Manager API, up through the /v1 portion. (Do not include trailing slash)")
flag.StringVar(&hsm, "hsm", "http://cray-smd/hsm/v2",
"Location of the Hardware State Manager API, up through the /v2 portion. (Do not include trailing slash)")
flag.StringVar(&syslogTarg, "syslog", "",
"Server:Port of the syslog aggregator")
flag.StringVar(&ntpTarg, "ntp", "",
Expand Down
4 changes: 2 additions & 2 deletions cmd/meds/meds_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* (C) Copyright [2019-2021] Hewlett Packard Enterprise Development LP
* (C) Copyright [2019-2022] Hewlett Packard Enterprise Development LP
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -528,7 +528,7 @@ func Test_notifyHSMXnamePresent(t *testing.T) {
map[string]HTTPResponse{
"/Inventory/RedfishEndpoints": HTTPResponse{
201,
`[{"URI": "/hsm/v1/Inventory/RedfishEndpoints/x0c0s0b0"}]`,
`[{"URI": "/hsm/v2/Inventory/RedfishEndpoints/x0c0s0b0"}]`,
json.RawMessage(`{"ID":"x7c5s3b1","FQDN":"x7c5s3b1","MACAddr":"02:00:07:05:33:10","RediscoverOnUpdate":true}`),
},
},
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.developer.full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ services:
context: .
command: ["vault_loader"]
environment:
- HSM_URL=http://cray-smd:27779/hsm/v1
- HSM_URL=http://cray-smd:27779/hsm/v2
- MEDS_OPTS=""
- CRAY_VAULT_AUTH_PATH=auth/token/create
- CRAY_VAULT_ROLE_FILE=configs/namespace
Expand All @@ -184,7 +184,7 @@ services:
build:
context: .
environment:
- HSM_URL=http://cray-smd:27779/hsm/v1
- HSM_URL=http://cray-smd:27779/hsm/v2
- "MEDS_OPTS=-sls http://cray-sls:8376/v1"
- CRAY_VAULT_AUTH_PATH=auth/token/create
- CRAY_VAULT_ROLE_FILE=configs/namespace
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/Cray-HPE/hms-bmc-networkprotocol v1.5.2
github.com/Cray-HPE/hms-certs v1.3.2
github.com/Cray-HPE/hms-compcredentials v1.11.2
github.com/Cray-HPE/hms-dns-dhcp v1.5.2
github.com/Cray-HPE/hms-dns-dhcp v1.6.0
github.com/Cray-HPE/hms-securestorage v1.12.2
github.com/Cray-HPE/hms-sls v1.10.4
github.com/Cray-HPE/hms-smd v1.30.9
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ github.com/Cray-HPE/hms-compcredentials v1.11.2 h1:Ug7e7vMSx1STHKkniWY27ddD1X49p
github.com/Cray-HPE/hms-compcredentials v1.11.2/go.mod h1:tmurR+zsOtB61n6j3GlEfsl7wmNIAGJqErFymOUb0Hw=
github.com/Cray-HPE/hms-dns-dhcp v1.5.2 h1:O/NMxUWy3zHGu1tYTyjNBa3MU5iSlKwJA01mR5AfO2w=
github.com/Cray-HPE/hms-dns-dhcp v1.5.2/go.mod h1:F5EyKyAD88Q+Mlc8N3YNUiY/hCfJDDtNyVF4MgN1h80=
github.com/Cray-HPE/hms-dns-dhcp v1.6.0 h1:m7yarg1Pju8ya9gkaATW7v1lcsMJFcDHCwNKwqkmYh4=
github.com/Cray-HPE/hms-dns-dhcp v1.6.0/go.mod h1:F5EyKyAD88Q+Mlc8N3YNUiY/hCfJDDtNyVF4MgN1h80=
github.com/Cray-HPE/hms-go-http-lib v1.5.3/go.mod h1:BKlB4HKAGW5GgS3x01y7zxxYFLaJM2byACUunmes2z8=
github.com/Cray-HPE/hms-msgbus v1.10.2/go.mod h1:DM5Iw58ejMxbCOX2KgmcBwDS5YWIlba3BOW9JsDQl4w=
github.com/Cray-HPE/hms-s3 v1.9.2/go.mod h1:p5pVsMDeOdXKssd9qyFtXo4ztrn2lhD04nrO8+NOi7g=
Expand Down
13 changes: 10 additions & 3 deletions runUnitTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,24 @@
#
set -x

# Add .exe if running in a WSL environment
if $(uname -r | grep -q "Microsoft"); then
shopt -s expand_aliases
alias docker-compose=docker-compose.exe
fi

# Configure docker compose
export COMPOSE_PROJECT_NAME=$RANDOM
export COMPOSE_FILE=docker-compose.test.unit.yaml

args="-f $COMPOSE_FILE -p $COMPOSE_PROJECT_NAME"

echo "COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME}"
echo "COMPOSE_FILE: $COMPOSE_FILE"


function cleanup() {
docker-compose down
docker-compose $args down
if ! [[ $? -eq 0 ]]; then
echo "Failed to decompose environment!"
exit 1
Expand All @@ -45,8 +52,8 @@ function cleanup() {


echo "Starting containers..."
docker-compose build
docker-compose up --exit-code-from unit-tests unit-tests
docker-compose $args build
docker-compose $args up --exit-code-from unit-tests unit-tests

test_result=$?

Expand Down
48 changes: 26 additions & 22 deletions vendor/github.com/Cray-HPE/hms-dns-dhcp/pkg/dns_dhcp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ github.com/Cray-HPE/hms-certs/pkg/hms_certs
# github.com/Cray-HPE/hms-compcredentials v1.11.2
## explicit
github.com/Cray-HPE/hms-compcredentials
# github.com/Cray-HPE/hms-dns-dhcp v1.5.2
# github.com/Cray-HPE/hms-dns-dhcp v1.6.0
## explicit
github.com/Cray-HPE/hms-dns-dhcp/pkg
# github.com/Cray-HPE/hms-securestorage v1.12.2
Expand Down

0 comments on commit 5fb6135

Please sign in to comment.