Code Monkey home page Code Monkey logo

sailfish's Introduction

redfish server (in progress... almost Redfish OCP Profile compliant)

This server will eventually do redfish...

Checkout and Dependencies

Prepare golang source structure and install necessary tools:

mkdir go
export GOPATH=$PWD/go
export PATH=$PATH:$GOPATH/bin
go get github.com/golang/dep/cmd/dep

Checkout sailfish source and install dependencies:

mkdir -p go/src/github.com/superchalupa/
cd go/src/github.com/superchalupa
git clone https://github.com/superchalupa/sailfish
cd sailfish
# Not really necessary any more:
# dep ensure
# the vendor/ directory is now included in the tree, so this step can be skipped

Usage

First, you need to select which data source you'd like to compile for. Currently "openbmc" is the only implemented (real) data source, but "simulation" is under development and works. Add the tag for the backend you want to the build, example below shows 'openbmc' build.

Build and run the backend (OPENBMC build):

go build -tags openbmc github.com/superchalupa/sailfish/cmd/ocp-server
./ocp-server -l https::8443 -l pprof:localhost:6060

Visit https://localhost:8443/redfish/v1

Build and run the backend (SIMULATION build):

go build -tags simulation github.com/superchalupa/sailfish/cmd/ocp-server
./ocp-server -l https::8443 -l pprof:localhost:6060

Visit https://localhost:8443/redfish/v1

This starts up a golang profiling endpoint on port 6060 at /debug/pprof for local debugging as well

RUNNING the backend without building first

Please read the previous two sections about tags! Example is for a simulation run:

go run -tags "simulation" cmd/ocp-server/main.go cmd/ocp-server/without-spacemonkey.go -l https::8443 -l pprof:localhost:6060

Tests

To run the (currently nonexistent) tests (need help here!):

go test ./...

Where to start

A good place to start looking is plugins/obmc/bmc.go. This is where we set up the BMC manager object, and it's pretty self contained and understandable.

Redfish Profile Validator

This server passes the redfish profile validation suite. To run that, check out the validtor and run it with the included config file, like so. (paths assume that service validator tool is checked out as a peer directory to go-redfish)

git clone https://github.com/DMTF/Redfish-Service-Validator
cd Redfish-Service-Validator
python3 ./RedfishServiceValidator.py -c ../go-redfish/scripts/Redfish-Service-Validator.ini 

Building for ARM with SPACEMONKEY (fast OpenSSL-based https support)

Golang implements it's own library for SSL/TLS. Unfortunately, this library is not as optimized as "openssl" on some systems. For instance, on ARM, golang takes twice as long to do SSL handshake compared to openssl. On most x86 and 64-bit ARM platforms, golang is competitive. So, for 32-bit ARM architectures, you should use spacemonkey, if possible, to get the best performance.

You can cross build without spacemonkey easily just by setting GOARCH=arm and running the go build tool. This will result in a binary that doesn't support the spacemonkey listener. Spacemonkey reduces the overhead by half for SSL-based HTTPS sessions on ARMv7.

You need to set up a few variables to point to your cross toolchain, and you'll need a cross go. Set the following variables. To run on aspeed or poleg, set GOARM=5, even though poleg is technically armv7

export PKG_CONFIG_PATH=.../path/to/cross/pkgconfig/pc/files/
export PATH=.../cross/go/bin:.../cross/gcc/

export GOARCH=arm
export GOARM=5
export GOOS=linux

go build -tags spacemonkey github.com/superchalupa/sailfish/cmd/ocp-server

When running, activate the spacemonkey listener with the command line arg: -l spacemonkey:[addr]:[port]

sailfish's People

Contributors

deweycoffman avatar jfewx avatar jrabbitsqr avatar maheshbaburamaiah avatar mario-sanchez avatar pboyd04 avatar ramarajuchaganti avatar sailm23 avatar sailred710 avatar superchalupa avatar windsparks33 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sailfish's Issues

Running in simulation mode crashes with missing file

I tried building in simulation mode and it crashes with a missing config file:

cwikj@p5540:~/go/src/github.com/superchalupa/sailfish$ sh scripts/build-simulation.sh 
+ find cmd/sailfish -type d
+ binaries=cmd/sailfish
+ TAGS=ec mockup
+ go build -tags simulation ec mockup github.com/superchalupa/sailfish/cmd/sailfish
+ echo

+ set +x
-e BUILD SUCCESS. binary ready: sailfish
cwikj@p5540:~/go/src/github.com/superchalupa/sailfish$ ./sailfish -l https::8443 -l pprof:localhost:6060
registering redfishresourceproperty with gob
Could not read config file: Config File "redfish" Not Found in "[/home/cwikj/go/src/github.com/superchalupa/sailfish /etc]"

If I copy redfish-simulation.yaml to redfish.yaml it appears to run. Is this correct?

Unable to post Metrics with EventSequencer

Hi, I was using EventSequencer tool to post events payloads to sailfish simulator, but the current version from master (2020/01/28) I am getting 404 response when I post events:

- FAIL, POST command failed, status code 404 returned, error is b'Could not find URL: /redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport\n'
ReportSequence: 5
-- 151 submit_test_event(http://127.0.0.1:10001/redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport)
-- URL---->  http://127.0.0.1:10001/redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport
-- Payload---->  {'@odata.type': '#MetricReport.v1_0_2.MetricReport', 'Id': 'ThermalSensor', 'MetricName': 'ThermalSensor', 'ReportSequence': 5, 'MetricReportDefinition': {'@odata.id': '/redfish/v1/TelemetryService/MetricReportDefinitions/ThermalSensor'}, 'MetricValues': [{'MetricId': 'HealthState', 'MetricValue': 'OK', 'Timestamp': '2019-05-28T18:16:09.072000000Z', 'Oem': {'Dell': {'@odata.type': '#Thermal.v1_0_2.Thermal', 'Label': 'CPU1 Temp', 'ContextID': 'iDRAC.Embedded.1#CPU1Temp'}}}, {'MetricId': 'CurrentState', 'MetricValue': 'Enabled', 'Timestamp': '2019-05-28T18:16:09.072000000Z', 'Oem': {'Dell': {'@odata.type': '#Thermal.v1_0_2.Thermal', 'Label': 'CPU1 Temp', 'ContextID': 'iDRAC.Embedded.1#CPU1Temp'}}}, {'MetricId': 'CurrentReading', 'MetricValue': '67', 'Timestamp': '2019-05-28T18:16:09.072000000Z', 'Oem': {'Dell': {'@odata.type': '#Thermal.v1_0_2.Thermal', 'Label': 'CPU1 Temp', 'ContextID': 'iDRAC.Embedded.1#CPU1Temp'}}}]}
-- <Response [404]>

Is the address /redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport no longer working?

Thanks,
Rodrigo.

SSE sending MetricReports in the same format as Events

When subscribing to SSE, MetricReports are sent in the same format as Events. See example payload below

id: 69
data: {
data:     "Id": "69",
data:     "@odata.context": "/redfish/v1/$metadata#Event.Event",
data:     "@odata.type": "#Event.v1_1_0.Event",
data:     "Name": "Event Array",
data:     "Events": [
data:         {
data:             "EventType": "Alert",
data:             "MessageId": "TST100",
data:             "OriginOfCondition": "/redfish/v1/TelmetryService/MetricReports/FanSensor",
data:             "Oem": {
data:                "@odata.type": "#MetricReport.v1_0_2.MetricReport",
data:                "Id": "FanSensor",
data:                "MetricName": "FanSensor",
data:                "MetricReportDefinition": {
data:                    "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/FanSensor"
data:                },
data:                "MetricValues": [
data:                    {
data:                        "MetricId": "HealthState",
data:                        "MetricValue": "OK",
data:                        "Oem": {
data:                            "Dell": {
data:                                "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                                "ContextDisplayName": "Chassis Fan1A",
data:                                "ContextID": "0x17||Fan.Embedded.1A"
data:                            }
data:                        },
data:                        "Timestamp": "2019-05-28T18:19:51.043000000Z"
data:                    },
data:                    {
data:                        "MetricId": "CurrentReading",
data:                        "MetricValue": "16",
data:                        "Oem": {
data:                            "Dell": {
data:                                "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                                "ContextDisplayName": "System Board Inlet Temp",
data:                                "ContextID": "iDRAC.Embedded.1#SystemBoardInletTemp"
data:                            }
data:                        },
data:                        "Timestamp": "2019-05-28T18:19:51.043000000Z"
data:                    }
data:                ],
data:                "ReportSequence": 80
data:            }
data:         },
data:         {
data:             "EventType": "ResourceAdded",
data:             "MessageId": "TST100",
data:             "OriginOfCondition": "/redfish/v1/TelemetryService/MetricReports/ThermalSensor"
data:         }
data:     ]
data: }

Expected format, as specified in DMTF's DSP0266_1.7.0.pdf (12.5.1.2. Metric report SSE stream), would be as below:

id: 69				
data:{
data:     "@odata.type": "#MetricReport.v1_0_2.MetricReport",
data:     "Id": "FanSensor",
data:     "MetricName": "FanSensor",
data:     "MetricReportDefinition": {
data:         "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/FanSensor"
data:     },
data:     "MetricValues": [
data:         {
data:             "MetricId": "HealthState",
data:             "MetricValue": "OK",
data:             "Oem": {
data:                 "Dell": {
data:                     "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                     "ContextDisplayName": "Chassis Fan1A",
data:                     "ContextID": "0x17||Fan.Embedded.1A"
data:                 }
data:             },
data:             "Timestamp": "2019-05-28T18:19:51.043000000Z"
data:         },
data:         {
data:             "MetricId": "CurrentReading",
data:             "MetricValue": "16",
data:             "Oem": {
data:                 "Dell": {
data:                     "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                     "ContextDisplayName": "System Board Inlet Temp",
data:                     "ContextID": "iDRAC.Embedded.1#SystemBoardInletTemp"
data:                 }
data:             },
data:             "Timestamp": "2019-05-28T18:19:51.043000000Z"
data:         }
data:     ],
data:     "ReportSequence": 80
data:}

MetricReports not updated after an Event is submitted

The following scenario works:

Step 1: run mock server

$ git clone https://github.com/DMTF/Redfish-Mockup-Server.git
$ git clone https://github.com/superchalupa/sailfish.git
$ cd Redfish-Mockup-Server
$ python3 redfishMockupServer.py -D ../sailfish/Mockup-Datasets/Server-PowerEdge-C6320 -H 0.0.0.0 -p 8443

Step 2: submit metrics

$ curl -H "Content-Type: application/json" -X POST http://Administrator:password@localhost:8443/redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport -d "{\"EventTimestamp\": \"2019-05-14 10:18:10.232853\", \"MetricName\": \"ThermalStatus\", \"MetricValues\": [{\"MetricDefinition\": \"Inlet Temp\", \"MetricId\": \"Health\", \"MetricProperty\": \"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp\", \"MetricValue\": \"OK\", \"Timestamp\": \"2019-05-14T13:18:10.236Z\" }, { \"MetricDefinition\": \"Inlet Temp\", \"MetricId\": \"Reading\", \"MetricProperty\": \"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp\", \"MetricValue\": \"15\", \"Timestamp\": \"2019-05-14T13:18:10.236Z\" }]}"

Step 3: get updated TelemetryService/MetricReports

curl http://localhost:8443/redfish/v1/TelemetryService/MetricReports/ThermalStatus
{
    "@odata.context": "/redfish/v1/$metadata#MetricReport.MetricReport",
    "@odata.id": "/redfish/v1/TelemetryService/MetricReports/ThermalStatus",
    "@odata.type": "#MetricReport.v1_0_0.MetricReport",
    "Id": "ThermalStatus",
    "MetricReportDefinition": {
        "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/ThermalStatus"
    },
    "MetricValues": [
        {
            "MetricDefinition": "Inlet Temp",
            "MetricId": "Health",
            "MetricProperty": "/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp",
            "MetricValue": "OK",
            "Timestamp": "2019-05-14T13:18:10.236Z"
        },
        {
            "MetricDefinition": "Inlet Temp",
            "MetricId": "Reading",
            "MetricProperty": "/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp",
            "MetricValue": "15",
            "Timestamp": "2019-05-14T13:18:10.236Z"
        }
    ],
    "Name": "ThermalStatus",
    "Timestamp": "2019-05-17T14:28:49-75"
}

As above, I was able to update my MetricReports by posting some events using Redfish-Mockup-Server. The same scenario does not seem to be working when I use sailfish as the server:

Step 4 using sailfish instead of Redfish-Mockup-Server

$ cd sailfish
$ cp redfish-mockup.yaml redfish.yaml
$ cp redfish-mockup-logging.yaml redfish-logging.yaml
$ go run ./cmd/sailfish/main.go ./cmd/sailfish/logging.go ./cmd/sailfish/sdnotify.go ./cmd/sailfish/without-spacemonkey.go ./cmd/sailfish/with-mockup.go -l http::8443

$ curl -H "Content-Type: application/json" -X POST http://Administrator:password@localhost:8443/redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport -d "{\"EventTimestamp\": \"2019-05-14 10:18:10.232853\", \"MetricName\": \"ThermalStatus\", \"MetricValues\": [{\"MetricDefinition\": \"Inlet Temp\", \"MetricId\": \"Health\", \"MetricProperty\": \"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp\", \"MetricValue\": \"OK\", \"Timestamp\": \"2019-05-14T13:18:10.236Z\" }, { \"MetricDefinition\": \"Inlet Temp\", \"MetricId\": \"Reading\", \"MetricProperty\": \"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp\", \"MetricValue\": \"15\", \"Timestamp\": \"2019-05-14T13:18:10.236Z\" }]}"
{"EventTimestamp":"2019-05-14 10:18:10.232853","MetricName":"ThermalStatus","MetricValues":[{"MetricDefinition":"Inlet Temp","MetricId":"Health","MetricProperty":"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp","MetricValue":"OK","Timestamp":"2019-05-14T13:18:10.236Z"},{"MetricDefinition":"Inlet Temp","MetricId":"Reading","MetricProperty":"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp","MetricValue":"15","Timestamp":"2019-05-14T13:18:10.236Z"}]}

$ curl http://localhost:8443/redfish/v1/TelemetryService/MetricReports/ThermalStatus
Could not find URL: /redfish/v1/TelemetryService/MetricReports/ThermalStatus

Could you please take a look and see that MetricReports is updated with the events sent to sailfish as they are when using Redfish-Mockup-Server?

Thanks in advance,
Rodrigo.

Using expand queries in GET requests

On iDRACs I am able to use expand queries to avoid opening multiple URLs and have all the payload data in a single response. Example:

On sailfish, it seems this expand command is not working and I am not able to get the contents of the subscribed resource and I have to open the address in another request to see the contents:

Response:

{
    "[email protected]": 1,
    "Name": "Event Subscriptions Collection",
    "@odata.id": "/redfish/v1/EventService/Subscriptions",
    "@odata.type": "#EventDestinationCollection.EventDestinationCollection",
    "@odata.context": "/redfish/v1/$metadata#EventDestinationCollection.EventDestinationCollection",
    "Description": "List of Event subscriptions",
    "Members": [
        {
            "@odata.id": "/redfish/v1/EventService/Subscriptions/0f6075d9-169f-4c21-8ce2-6c814665fb6a"
        }
    ]
}

Is there a way to have this behaviour simulated in sailfish to get a response that would look like an actual iDRAC?

Thanks,
Rodrigo.

Potential import collision: import path should be "go.etcd.io/bbolt", not "github.com/etcd-io/bbolt".

Background

The etcd-io/bbolt has already renamed it’s import path from "github.com/etcd-io/bbolt" to "go.etcd.io/bbolt".
As README of etcd-io/bbolt v1.3.2 said, downstream repos should use "go.etcd.io/bbolt" to get or import etcd-io/bbolt.

To start using Bolt, install Go and run go get:
>$ go get go.etcd.io/bbolt/...
This will retrieve the library and install the bolt command line utility into your $GOBIN path.

Importing bbolt
To use bbolt as an embedded key-value store, import as:
>import bolt "go.etcd.io/bbolt"
…

But sailfishdell/sailfish still used the old path:
https://github.com/sailfishdell/sailfish/blob/master/go.mod#L7

github.com/etcd-io/bbolt v1.3.2"

When you use the old path "github.com/etcd-io/bbolt" to import the etcd-io/bbolt, it will be very easy to reintroduce etcd-io/bbolt through the import statements "import go.etcd.io/bbolt" in the go source file of etcd-io/bbolt.
https://github.com/etcd-io/bbolt/blob/v1.3.2/cursor_test.go#L14

package bbolt_test
import (
	bolt "go.etcd.io/bbolt"
	…
) 

The "go.etcd.io/bbolt" and "github.com/etcd-io/bbolt" are the same repos. This will work in isolation, bring about potential risks and problems.

Solution

Replace all the old import paths, change "github.com/etcd-io/bbolt" to "go.etcd.io/bbolt".
Where did you import it: https://github.com/sailfishdell/sailfish/search?q=github.com%2Fetcd-io%2Fbbolt&unscoped_q=github.com%2Fetcd-io%2Fbbolt

ExternalMetricEvent is not mapped by SSE event streams

When sending telemetry metrics, subscription returns the payload, but sse does not. SSE only returns events, missing all metric reports sent.

I had to change the code with the following to enable metric reports:

diff --git a/src/http_redfish_sse/rfsse_handler.go b/src/http_redfish_sse/rfsse_handler.go
index 6eb1c66..da9171d 100644
--- a/src/http_redfish_sse/rfsse_handler.go
+++ b/src/http_redfish_sse/rfsse_handler.go
@@ -42,10 +42,10 @@ func (rh *RedfishSSEHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
        requestLogger.Info("Trying to start RedfishSSE Stream for request.", "context", rfSubContext)

        l, err := rh.d.EventWaiter.Listen(ctx, func(event eh.Event) bool {
-               if event.EventType() != eventservice.ExternalRedfishEvent {
-                       return false
+               if event.EventType() != eventservice.ExternalRedfishEvent || event.EventType() != eventservice.ExternalMetricEvent {
+                       return true
                }
-               return true
+               return false
        })
        if err != nil {
                requestLogger.Crit("Could not create an event waiter.", "err", err)
@@ -121,11 +121,12 @@ func (rh *RedfishSSEHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
                        // TODO: we should encode to output rather than buffering internally in a string
                        fmt.Fprintf(w, "id: %d\n", evt.Id)
                        fmt.Fprintf(w, "data: %s\n\n", d)
-               } else {
+               }
+               if evt, ok := event.Data().(eventservice.MetricReportData); ok {
                        // Handle metric reports
                        // TODO: find a better way to unify these
                        // sucks that we have to handle these two separately, but for now have to do it this way
-                       d, err := json.MarshalIndent(event.Data(), "data: ", "    ")
+                       d, err := json.MarshalIndent(evt.Data, "data: ", "    ")
                        if err != nil {
                                requestLogger.Error("MARSHAL SSE (metric report) FAILED", "err", err, "data", event.Data(), "event", event)
                                return

Note that I also had to change how the MetricReportData was marshaled, because the code as it was it was sending the payload with and extra "Data {}" at the root level of the json.

Event Subscription stopped working after Feb 6th commits

Hi I am having a regression issue related to Event Subscriptions. The following sequence is not forwarding any payloads:

Step 1: start sailfish

$ git clone https://github.com/superchalupa/sailfish.git
$ cd sailfish
$ git checkout 1751275877eb7ed6fa5077c00722377d5524be96
$ cp redfish-mockup.yaml redfish.yaml
$ cp redfish-mockup-logging.yaml redfish-logging.yaml
$ go run ./cmd/sailfish/main.go ./cmd/sailfish/logging.go ./cmd/sailfish/sdnotify.go ./cmd/sailfish/without-spacemonkey.go ./cmd/sailfish/with-mockup.go -l http::8443

Logs:
CRIT[05-17|14:20:30] Action running!                          module=ec fn=github.com/superchalupa/sailfish/src/actionhandler.StartService.func2 caller=handler.go:129
CRIT[05-17|14:20:30] URI                                      module=ec uri=/redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport fn=github.com/superchalupa/sailfish/src/actionhandler.StartService.func2 caller=handler.go:141
CRIT[05-17|14:20:30] handler                                  module=ec handler=0x91bf80 fn=github.com/superchalupa/sailfish/src/actionhandler.StartService.func2 caller=handler.go:145

Step 2: start listening to events

$ git clone https://github.com/DMTF/Redfish-Event-Listener
$ cd Redfish-Event-Listener
$ (...) configure config.ini to update [SystemInformation], [SubsciptionDetails] and [ServerInformation] sections
$ python RedfishEventListener_v1.py

Step 3: post event:

$ curl -H "Content-Type: application/json" -X POST http://Administrator:password@localhost:8443/redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport -d "{\"EventTimestamp\": \"2019-05-14 10:18:10.232853\", \"MetricName\": \"ThermalStatus\", \"MetricValues\": [{\"MetricDefinition\": \"Inlet Temp\", \"MetricId\": \"Health\", \"MetricProperty\": \"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp\", \"MetricValue\": \"OK\", \"Timestamp\": \"2019-05-14T13:18:10.236Z\" }, { \"MetricDefinition\": \"Inlet Temp\", \"MetricId\": \"Reading\", \"MetricProperty\": \"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp\", \"MetricValue\": \"15\", \"Timestamp\": \"2019-05-14T13:18:10.236Z\" }]}"
{"EventTimestamp":"2019-05-14 10:18:10.232853","MetricName":"ThermalStatus","MetricValues":[{"MetricDefinition":"Inlet Temp","MetricId":"Health","MetricProperty":"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp","MetricValue":"OK","Timestamp":"2019-05-14T13:18:10.236Z"},{"MetricDefinition":"Inlet Temp","MetricId":"Reading","MetricProperty":"/redfish/v1/Chassis/System.Embedded.1/Thermal/InletTemp","MetricValue":"15","Timestamp":"2019-05-14T13:18:10.236Z"}]}

The same scenario was working if I replace the commit from sailfish with this commit 147c130:

Re-run the steps 1,2,3 by checkout out 147c130 in step 1:

$ git clone https://github.com/superchalupa/sailfish.git
$ cd sailfish
$ git checkout 147c130531b0a78a41208fd745734269b4f23ab4
$ cp redfish-mockup.yaml redfish.yaml
$ cp redfish-mockup-logging.yaml redfish-logging.yaml
$ go run ./cmd/sailfish/main.go ./cmd/sailfish/logging.go ./cmd/sailfish/sdnotify.go ./cmd/sailfish/without-spacemonkey.go ./cmd/sailfish/with-mockup.go -l http::8443

Logs:
WARN[05-17|14:21:33] ERROR POSTING                            module=event_service err="Post http://10.26.103.19:1444: EOF" fn=github.com/superchalupa/sailfish/src/ocp/eventservice.makePOST.func1 caller=entrypoint.go:218
CRIT[05-17|14:21:42] Action running!                          module=ec fn=github.com/superchalupa/sailfish/src/actionhandler.StartService.func2 caller=handler.go:129
CRIT[05-17|14:21:42] URI                                      module=ec uri=/redfish/v1/TelemetryService/Actions/TelemetryService.SubmitTestMetricReport fn=github.com/superchalupa/sailfish/src/actionhandler.StartService.func2 caller=handler.go:141
CRIT[05-17|14:21:42] handler                                  module=ec handler=0x905fd0 fn=github.com/superchalupa/sailfish/src/actionhandler.StartService.func2 caller=handler.go:145
WARN[05-17|14:21:42] ERROR POSTING                            module=event_service err="Post http://10.26.103.19:1444: EOF" fn=github.com/superchalupa/sailfish/src/ocp/eventservice.makePOST.func1 caller=entrypoint.go:218

It looks like the commit from "JIT-120888 More eventing fixes, forcing each event into a seperate PO" added a regression issue and its causing EventSubscription to not foward the events to its subscribed listeners.

Before this commit I was able to subscribe and get the payloads from sailfish just fine.
Could you please take a look?

Thanks,
Rodrigo.

TelemetryService.SubmitTestMetricReport generating Alert events instead of MetricReports

When testing July 8th sailfish, we noticed that the payload generated by TelemetryService.SubmitTestMetricReport is an Alert Event containing a MetricReport as content of OEM property instead of a MetricReport.
The goal of SumitTestMetricReport is to generate MetricReport payloads for testing purposes.
See below the payload from our testing:

{
 "Context": "Public",
 "EventType": "Alert",
 "MemberId": "60376dbe-cf2d-40d4-8064-5e0a9fc1d364",
 "[email protected]": 0,
 "MessageId": "TS00",
 "Oem": {
     "@odata.type": "#MetricReport.v1_0_2.MetricReport",
     "Id": "ThermalSensor",
     "MetricName": "ThermalSensor",
     "MetricReportDefinition": {
         "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/ThermalSensor"
     },
     "MetricValues": [
         {
             "MetricId": "HealthState",
             "MetricValue": "OK",
             "Oem": {
                 "Dell": {
                     "@odata.type": "#Thermal.v1_0_2.Thermal",
                     "ContextDisplayName": "CPU1 Temp",
                     "ContextID": "iDRAC.Embedded.1#CPU1Temp"
                 }
             },
             "Timestamp": "2019-05-28T18:23:08.283000000Z"
         }
     ],
     "ReportSequence": 145
 },
 "OriginOfCondition": "/redfish/v1/TelmetryService/MetricReports/ThermalSensor"
}

The expected response would be the MetricReport direct, as below:

 {
     "@odata.type": "#MetricReport.v1_0_2.MetricReport",
     "Id": "ThermalSensor",
     "MetricName": "ThermalSensor",
     "MetricReportDefinition": {
         "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/ThermalSensor"
     },
     "MetricValues": [
         {
             "MetricId": "HealthState",
             "MetricValue": "OK",
             "Oem": {
                 "Dell": {
                     "@odata.type": "#Thermal.v1_0_2.Thermal",
                     "ContextDisplayName": "CPU1 Temp",
                     "ContextID": "iDRAC.Embedded.1#CPU1Temp"
                 }
             },
             "Timestamp": "2019-05-28T18:23:08.283000000Z"
         }
     ],
     "ReportSequence": 145
 }

SSE posting streams with broken data

There are 2 issues related to SSE:

  1. There is a missing data: in the beginning of a new SSE stream event. See below how it was before and how it is now.
    Before:
data: {
data:     "@odata.type": "#MetricReport.v1_0_2.MetricReport",
data:     "Id": "ThermalSensor",
data:     "MetricName": "ThermalSensor",
data:     "MetricReportDefinition": {
data:         "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/ThermalSensor"
data:     },
data:     "MetricValues": [
data:         {
data:             "MetricId": "HealthState",
data:             "MetricValue": "OK",
data:             "Oem": {
data:                 "Dell": {
data:                     "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                     "ContextID": "iDRAC.Embedded.1#CPU1Temp",
data:                     "Label": "CPU1 Temp"
data:                 }
data:             },
data:             "Timestamp": "2019-05-28T18:16:09.072000000Z"
data:         },
data:         {
data:             "MetricId": "CurrentState",
data:             "MetricValue": "Enabled",
data:             "Oem": {
data:                 "Dell": {
data:                     "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                     "ContextID": "iDRAC.Embedded.1#CPU1Temp",
data:                     "Label": "CPU1 Temp"
data:                 }
data:             },
data:             "Timestamp": "2019-05-28T18:16:09.072000000Z"
data:         },
data:         {
data:             "MetricId": "CurrentReading",
data:             "MetricValue": "67",
data:             "Oem": {
data:                 "Dell": {
data:                     "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                     "ContextID": "iDRAC.Embedded.1#CPU1Temp",
data:                     "Label": "CPU1 Temp"
data:                 }
data:             },
data:             "Timestamp": "2019-05-28T18:16:09.072000000Z"
data:         }
data:     ],
data:     "ReportSequence": 5
data: }

Now:

{
data:     "Data": {
data:         "@odata.type": "#MetricReport.v1_0_2.MetricReport",
data:         "Id": "ThermalSensor",
data:         "MetricName": "ThermalSensor",
data:         "MetricReportDefinition": {
data:             "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/ThermalSensor"
data:         },
data:         "MetricValues": [
data:             {
data:                 "MetricId": "HealthState",
data:                 "MetricValue": "OK",
data:                 "Oem": {
data:                     "Dell": {
data:                         "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                         "ContextID": "iDRAC.Embedded.1#CPU1Temp",
data:                         "Label": "CPU1 Temp"
data:                     }
data:                 },
data:                 "Timestamp": "2019-05-28T18:16:09.072000000Z"
data:             },
data:             {
data:                 "MetricId": "CurrentState",
data:                 "MetricValue": "Enabled",
data:                 "Oem": {
data:                     "Dell": {
data:                         "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                         "ContextID": "iDRAC.Embedded.1#CPU1Temp",
data:                         "Label": "CPU1 Temp"
data:                     }
data:                 },
data:                 "Timestamp": "2019-05-28T18:16:09.072000000Z"
data:             },
data:             {
data:                 "MetricId": "CurrentReading",
data:                 "MetricValue": "67",
data:                 "Oem": {
data:                     "Dell": {
data:                         "@odata.type": "#Thermal.v1_0_2.Thermal",
data:                         "ContextID": "iDRAC.Embedded.1#CPU1Temp",
data:                         "Label": "CPU1 Temp"
data:                     }
data:                 },
data:                 "Timestamp": "2019-05-28T18:16:09.072000000Z"
data:             }
data:         ],
data:         "ReportSequence": 5
data:     }
data: }

Note that SSE events need to have a data: each new line.

  1. Second issue is related to the structure. Note that the payload is now encapsulated within "Data", the payload was supposed to be the same as the payload sent by subscription.

Error on MetricReportDefition PATCH

Hi,

I'm trying to PATCH a metric report definition like redfish/v1/TelemetryService/MetricReportDefinitions/CPUSensor to change RecurrenceInterval and MetricReportDefinitionEnabled values

{
"Schedule": {
"RecurrenceInterval": "T90"
},
"MetricReportDefinitionEnabled": false
}

I'm able to do this PATCH resquest to RedfishMockupServer, but the sailfish always returns HTTP 401 - Unauthorized using Administrator/password basic auth header.

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.