The Bare Metal Event Relay works with Cloud Event Proxy. Run cloud-event-proxy sidecar and consumer example from the cloud-event-proxy repo for testing locally.
export NODE_NAME=mynode
export HW_PLUGIN=true; export HW_EVENT_PORT=9087; export CONSUMER_TYPE=HW
export MSG_PARSER_PORT=9097; export MSG_PARSER_TIMEOUT=10
export LOG_LEVEL=trace
# replace the following with real Redfish credentials and BMC ip address
export REDFISH_USERNAME=user; export REDFISH_PASSWORD=pass; export REDFISH_HOSTADDR=10.10.10.10
sudo dnf install qpid-dispatch-router
qdrouterd &
cd <cloud-event-proxy repo>
make build-plugins
# Test with HTTP Transport
go run cmd/main.go --transport-host="localhost:9043" --http-event-publishers="localhost:9043" --api-port=9085
# Test with AMQ Transport
go run cmd/main.go --transport-host="amqp:localhost:5672" --api-port=9085
cd <cloud-event-proxy repo>
go run examples/consumer/main.go --api-addr=localhost:9085
cd <hw-event-proxy repo>/hw-event-proxy
make run
cd <hw-event-proxy repo>/message-parser
# install dependencies
pip3 install -r requirements.txt
python3 server.py
curl -X POST -i http://localhost:${HW_EVENT_PORT}/webhook -H "Content-Type: text/plain" --data @e2e-tests/data/TMP0100.json
# Test Message Parser
curl -X POST -i http://localhost:${HW_EVENT_PORT}/webhook -H "Content-Type: text/plain" --data @e2e-tests/data/TMP0100-no-msg-field.json
1. scripts/local-ldd-dep.sh
2. edit build-image.sh and rename Dockerfile to Dockerfile.local
scripts/build-go.sh
scripts/build-image.sh
TAG=xxx
podman push localhost/hw-event-proxy:${TAG} quay.io/jacding/hw-event-proxy:latest
export VERSION=latest
export PROXY_IMG=quay.io/redhat-cne/hw-event-proxy:${VERSION}
export SIDECAR_IMG=quay.io/redhat-cne/cloud-event-proxy:${VERSION}
export CONSUMER_IMG=quay.io/redhat-cne/cloud-event-consumer:${VERSION}
# replace the following with real Redfish credentials and BMC ip address
export REDFISH_USERNAME=user; export REDFISH_PASSWORD=pass; export REDFISH_HOSTADDR=10.10.10.10
# with HTTP Transport
make deploy
# with AMQ Transport
make deploy-amq
# with HTTP Transport
make undeploy
# with AMQ Transport
make undeploy-amq
With HTTP transport, the event producer uses a pubsubstore to store Subscriber information, including clientID, consumer service endpoint URI, resource ID etc. These are stored as one json file per registered subscriber. The pubsubstore needs to be mounted to a persistent volume using a Persistent Volume Claim (PVC) in order to survive a pod reboot.
As a prerequisite, a Persistent Volume (PV) needs to be created to map to the PVC. The PV can be created either automatically by the Local Storage operator or manually as the example below:
Example of deploying PV using local storage:
📝 NOTE: The /mnt/local-storage directory needs to be manually created on the node.
make install-pv
Undeploy
make uninstall-pv
Deploy using persistentVolumeClaim:
make deploy-pvc
Undeploy
make undeploy-pvc
📝 NOTE: The configuration of LocalVolume and PV need to be customized for the specific hardware being used.
Prerequisite: a working Kubernetes cluster. Have the environment variable KUBECONFIG
set pointing to your cluster.
cd e2e-tests
make build
scripts/build-image.sh
TAG=xxx
podman push localhost/hw-event-proxy-e2e-test:${TAG} quay.io/jacding/hw-event-proxy-e2e-test:latest
# with HTTP Transport
make test
# with AMQ Transport
make test-amq
The sanity test sets up one test pod and one consumer in the same node and sends out Redfish Events to the hw-event-proxy at a rate of 1 msg/sec.
The contents of the received events are verified in the test. The list of fields to check are defined the file e2e-tests/data/EVENT_FIELDS_TO_VERIFY
.
The events to be tested are defined in the e2e-tests/data
folder with one JSON file per event. List of events are described here.
📝 Add new tests by adding JSON files in
e2e-tests/data
. Add description if needed.
📝 Update message fields to check by updating
e2e-tests/data/EVENT_FIELDS_TO_VERIFY
.
# with HTTP Transport
make test-perf
# with AMQ Transport
make test-perf-amq
The performance test sets up one test pod and 20 consumers in the same node and sends out Redfish Events to the hw-event-proxy
at a rate of 10 msgs/sec for 10 minutes.
The tests are marked PASSED if the performance targets are met.
Performance Target: 95% of the massages should have latency within 10ms.
Full test report is available at ./logs/_report.csv
curl -X POST -i --insecure -u "${REDFISH_USERNAME}:${REDFISH_PASSWORD}" https://${REDFISH_HOSTADDR}/redfish/v1/EventService/Subscriptions \
-H 'Content-Type: application/json' \
--data-raw '{
"Protocol": "Redfish",
"Context": "any string is valid",
"Destination": "https://hw-event-proxy-openshift-hw-events.apps.example.com/webhook",
"EventTypes": ["Alert"]
}'
# Create Redfish Subscription for ZT BMC
curl -X POST -i --insecure -u "${REDFISH_USERNAME}:${REDFISH_PASSWORD}" https://${REDFISH_HOSTADDR}/redfish/v1/EventService/Subscriptions \
-H 'Content-Type: application/json' \
--data-raw '{
"Protocol": "Redfish",
"Context": "any string is valid",
"Destination": "https://hw-event-proxy-openshift-hw-events.apps.example.com/webhook"
}'
curl --insecure -u "${REDFISH_USERNAME}:${REDFISH_PASSWORD}" https://${REDFISH_HOSTADDR}/redfish/v1/EventService/Subscriptions | jq .
curl -X DELETE -i --insecure -u "${REDFISH_USERNAME}:${REDFISH_PASSWORD}" https://${REDFISH_HOSTADDR}/redfish/v1/EventService/Subscriptions/<sub_id>
curl -X POST -i --insecure -u "${REDFISH_USERNAME}:${REDFISH_PASSWORD}" https://${REDFISH_HOSTADDR}/redfish/v1/EventService/Actions/EventService.SubmitTestEvent \
-H 'Content-Type: application/json' \
--data-raw '{
"EventId": "TestEventId",
"EventTimestamp": "2022-08-23T15:13:49Z",
"EventType": "Alert",
"Message": "Test Event",
"MessageId": "TMP0118",
"OriginOfCondition": "/redfish/v1/Systems/1/",
"Severity": "OK"
}'
# Submit Test Event for ZT BMC
curl -X POST -i --insecure -u "${REDFISH_USERNAME}:${REDFISH_PASSWORD}" https://${REDFISH_HOSTADDR}/redfish/v1/EventService/Actions/EventService.SubmitTestEvent \
-H 'Content-Type: application/json' \
--data-raw '{
"MessageId": "EventLog.1.0.ResourceUpdated"
}'
curl -X POST -i --insecure https://$(kubectl -n openshift-bare-metal-events get route hw-event-proxy -o jsonpath="{.spec.host}")/webhook \
-H "Content-Type: text/plain" \
--data @e2e-tests/data/TMP0100.json
export SIDECAR_IMG=quay.io/redhat-cne/cloud-event-proxy:release-4.10
export CONSUMER_IMG=quay.io/redhat-cne/cloud-event-consumer:release-4.10
# assuming amqp service is running at amq-router.amq-router
make deploy-consumer-amq
make undeploy-consumer-amq
export SIDECAR_IMG=quay.io/redhat-cne/cloud-event-proxy:latest
export CONSUMER_IMG=quay.io/redhat-cne/cloud-event-consumer:latest
# for HTTP Transport
make deploy-consumer
make undeploy-consumer
# for AMQP Transport
make deploy-consumer-amq
make undeploy-consumer-amq