Skip to content

Instantly share code, notes, and snippets.

@Krellan
Last active April 1, 2022 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krellan/f511e65166ebe5435fde3f847d28fe73 to your computer and use it in GitHub Desktop.
Save Krellan/f511e65166ebe5435fde3f847d28fe73 to your computer and use it in GitHub Desktop.
Preloading some content before running Redfish Validator
#!/bin/sh
CONFIG="./config/example.ini"
LOCATION=$(cat "$CONFIG" | grep '^ip = ' | cut '-d ' -f3-)
USERNAME=$(cat "$CONFIG" | grep '^username = ' | cut '-d ' -f3-)
USERNAME=$(cat "$CONFIG" | grep '^password = ' | cut '-d ' -f3-)
echo "First run:"
echo "ssh -L localhost:8000:localhost:80 root@your-bmc-hostname"
curl -u "${USERNAME}:${PASSWORD}" -X POST "${LOCATION}/redfish/v1/Systems/system/LogServices" -d '
{
"Id": "MyInstance0",
"@odata.type": "#LogService.v1_3_0.LogService",
"Name": "Instance 0 Outer Layer",
"Description": "Example instance for testing",
"Entries": {
"@odata.type": "#LogEntryCollection.LogEntryCollection",
"Name": "Instance 0 Inner Layer",
"Description": "There should be zero entries here"
}
}'
curl -u "${USERNAME}:${PASSWORD}" -X POST "${LOCATION}/redfish/v1/Systems/system/LogServices" -d '
{
"Id": "MyInstance1",
"@odata.type": "#LogService.v1_3_0.LogService",
"Name": "Instance 1 Outer Layer",
"Description": "Example instance for testing",
"Entries": {
"@odata.type": "#LogEntryCollection.LogEntryCollection",
"Name": "Instance 1 Inner Layer",
"Description": "There should be one entry here"
}
}'
curl -u "${USERNAME}:${PASSWORD}" -X POST "${LOCATION}/redfish/v1/Systems/system/LogServices/MyInstance1" -d '
{
"Id": "MyEntry",
"@odata.type": "#LogEntry.v1_11_0.LogEntry",
"EntryType": "Oem",
"OemRecordFormat": "Example",
"Name": "The only entry within Instance 1",
"Description": "Created without including the Entries URL suffix"
}'
curl -u "${USERNAME}:${PASSWORD}" -X POST "${LOCATION}/redfish/v1/Systems/system/LogServices" -d '
{
"Id": "MyInstance2",
"@odata.type": "#LogService.v1_3_0.LogService",
"Name": "Instance 2 Outer Layer",
"Description": "Example instance for testing",
"Entries": {
"@odata.type": "#LogEntryCollection.LogEntryCollection",
"Name": "Instance 2 Inner Layer",
"Description": "There should be two entries here"
}
}'
curl -u "${USERNAME}:${PASSWORD}" -X POST "${LOCATION}/redfish/v1/Systems/system/LogServices/MyInstance2/Entries" -d '
{
"Id": "MyEntryA",
"@odata.type": "#LogEntry.v1_11_0.LogEntry",
"EntryType": "Oem",
"OemRecordFormat": "Example",
"Name": "Entry A within Instance 2",
"Description": "Created with the Entries URL suffix included"
}'
curl -u "${USERNAME}:${PASSWORD}" -X POST "${LOCATION}/redfish/v1/Systems/system/LogServices/MyInstance2/Entries" -d '
{
"Id": "MyEntryB",
"@odata.type": "#LogEntry.v1_11_0.LogEntry",
"EntryType": "Oem",
"OemRecordFormat": "Example",
"Name": "Entry B within Instance 2",
"Description": "Another entry within Instance 2"
}'
echo "Now run:"
echo "python RedfishServiceValidator.py -c ./config/example.ini"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment