dmtf / redfish-mockup-server Goto Github PK
View Code? Open in Web Editor NEWA simple Python 3.4 program that can be copied into a folder at the top of any Redfish mockup and can serve Redfish requests on the specified IP/port.
License: Other
A simple Python 3.4 program that can be copied into a folder at the top of any Redfish mockup and can serve Redfish requests on the specified IP/port.
License: Other
The collection is originally:
After doing a sequence of
Post {'a':1}
Delete /redfish/v1/Chassis/Blade1
Post {'b':2}
The collection becomes
The server ends up with 2 new members with the same URI. This happens dues to the way the redfishMockupServer names new member newpath = '/{}/{}'.format(xpath, len(members) + 1)
In addition, The redfishMockupServer updates '[email protected]' after a Post operation, but doesn't update '[email protected]' after a delete operation
I am trying to use a self-signed certificate with Docker and I am wondering if it's even supported with Redfish-Mockup-Server
openssl req -new -x509 -keyout cert.pem -out cert.pem -days 365 -nodes
And run Docker:
docker run --rm --name asb88rn24u01 -p 80:80/tcp -p 443:443/tcp -v C:\asb88rn24u01:/mockup -v C:\cert.pem:/temp/cert.pem -v C:\key.pem:/temp/key.pem dmtf/redfish-mockup-server:latest -D /mockup --cert /temp/cert.pem --key /temp/key.pem -p 443
It successfully connects but its having trouble with the certificate version being served
| Serving Mockup in absolute path: /usr/src/app/public-rackmount1
| Using SSL with certfile: /opt/cert.pem
| Traceback (most recent call last):
| File "/usr/src/app/redfishMockupServer.py", line 918, in <module>
| main()
| File "/usr/src/app/redfishMockupServer.py", line 867, in main
| myServer.socket = ssl.wrap_socket(myServer.socket, certfile=sslCert, keyfile=sslKey, server_side=True)
| ^^^^^^^^^^^^^^^
| AttributeError: module 'ssl' has no attribute 'wrap_socket'
with code 1
proposed fix #104
Call to redfishTransport on line 703 returns None on a specific condition involving paged payloads, appearing to miss a fallback condition and returning absolutely nothing, which normally always returns a tuple, causing an exception.
#DB5: Transport.ProcessRequest: url=https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=50
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=100
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=150
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=200
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=250
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=300
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=350
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=400
#REQUEST: Transport:SendRecv: GET https://10.36.0.117/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=450
... [[[Normally crashes here]]]
redfishMockupCreate: ERROR:readResourceMkdirCreateIndxFile: Error reading resource: link:{'@odata.id': '/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog'}
Patch on line 703 to allow progress past this pt and print this line, but requires updating the transport, see if this bug exists in the original codebase.
fixed by #126
Skips all POSTs to Collection as it sends 409 to users attempting to POST to ANY resource that exists, before checking if it is a Collection.
Currently corrected in post-fix branch
Update the README for the Redfish Mockup Server to enhance clarity.
Hello
I am new to this.
I am using redfish-profile-simulator (https://github.com/DMTF/Redfish-Profile-Simulator) and got the output on localhost on ubuntu.
Can I implement this python file on top it?
If yes, Can you please provide the procedure steps.
Thanks
Mockup Server does not support the Multipart HTTP Push firmware update process. It would be beneficial to have this implemented, along with task monitoring support, to be able to test external tools that perform firmware updates.
Versions 1.1.6 and 1.1.7 introduce the Content-Length header in responses. This breaks scripts piping responses in JSON processors like jq.
Would it be possible to have the Content-Length included in responses only if asked on the command line ?
Thanks
Redfish-Mockup-Server supports Redfish Eventing subscription mechanism. Request that support for SSE GET mechanism at EventService.ServerSentEventURI be supported for Redfish EventService and Redfish TelemetryService.
Hello, first of all thanks for all the hard work done on Redfish. I really enjoy working with local mockup server that provides the sample rack mounted server experience.
Would it be possible to provided mock files in this repo for other systems you have available on your website? I am testing some python scripts and it would be great to test against a Blade system. Unfortunately I do not have one available to create a mockup from it.
Thanks.
Feature as requested in Slack by some folks.
When trying to access resources on the mockup server with Chrome 60.0.3112.101, Service Root is able to be access successfully, but subordinate resources seem to just "hang", ultimately causing an error in the browser. Firefox seems to work okay though. I do see a difference in the types of request headers being sent between the browsers, and I suspect one of those headers is not being handled nicely by the mockup server.
Good case (Firefox):
GET: Headers: Host: localhost:8000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
False
127.0.0.1 - - [17/Aug/2017 15:57:13] "GET /redfish/v1/Managers HTTP/1.1" 200 -
Bad case (Chrome):
GET: Headers: Host: localhost:8000
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.8
False
127.0.0.1 - - [17/Aug/2017 15:59:41] "GET /redfish/v1/Managers HTTP/1.1" 200 -
Although the "bad" case returns a 200, the web browser shows:
This page isn’t working
localhost sent an invalid response.
ERR_INVALID_HTTP_RESPONSE
Mockup Server supports Posting Subscriptions and invoking SubmitTestEvent ... but does not support Delete of Subscriptions. Requesting the Mockup Server to support Delete of Subscriptions.
see https://hub.docker.com/r/dmtf/redfish-mockup-server/tags?page=&page_size=&ordering=&name=latest
Last pushed a year ago by [dmtf](https://hub.docker.com/u/dmtf)
I think it is best to remove this tag completely or as alternative keep it up2date with every release
Clarify installation instruction for Redfish Mockup Server.
As the mockups contained in the private repos and distributed publicly do not contain the /redfish/v1 directory structure necessary for the mockup server to function, it might be wise to detect if it exists or not. It can then be generated and simulated on behalf of the client.
The existing Mockup-Server support for POSTing to an existing Collection is very helpful. But the fidelity could be improved with some relatively simple enhancements:
Id
, Name
, @odata.id
, and @odata.type
properties to the newly created resourcedocker-compose down
/ docker-stop
after the server is started and healthy results in the container taking the maximum 10s
to stop with exit code 137 (SIGKILL).
$ docker run -p 8000:8000 dmtf/redfish-mockup-server
Redfish Mockup Server, version 1.1.8
Hostname: 0.0.0.0
Port: 8000
Mockup directory path specified: public-rackmount1
Response time: 0 seconds
Serving Mockup in absolute path: /usr/src/app/public-rackmount1
Serving Redfish mockup on port: 8000
running Server...
('GET', '/redfish/v1')
GET: Headers: Host: 127.0.0.1:8000
User-Agent: curl/7.74.0
Accept: */*
127.0.0.1 - - [07/Aug/2022 17:44:44] "GET /redfish/v1 HTTP/1.1" 200 -
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
67e7a97f08aa dmtf/redfish-mockup-server "python /usr/src/app…" 36 seconds ago Up 34 seconds (healthy) 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp boring_visvesvaraya
$ docker stop 67e7a97f08aa
67e7a97f08aa
$ docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
67e7a97f08aa dmtf/redfish-mockup-server "python /usr/src/app…" About a minute ago Exited (137) 7 seconds ago boring_visvesvaraya
While the mockups themselves require copyright info to show who created it, when being used in the mockup server, there's no need for it to be broadcasted. We should remove it from the payload so that we can use mockups as-is with conformance checks.
Looks like there is a bug in add_new_member()
where Member
is used without numbers
Looks like it was dropped in one the refactor commits 229e55c#diff-aec90ae4bd10ec56e048982d2544df5a5c3992e8787e7d5e63a67c8b8551e1e6L340
https://github.com/DMTF/Redfish-Mockup-Server/blame/3971d54e196054de0ddb1df6ade0c661cb798dd7/redfishMockupServer.py#L340
newpath_id = data_received.get('Id', 'Member{}'.format(n))
Also Id
and @odata.id
is missing in newly created member
pulled from DMTF/Redfish-Mockup-Creator#6
The Mockup Server will not server local files as is, only if they are directories containing index files. Example:
│ ├── Schemas
│ │ ├── AccountService.1.0.0.json
│ │ │ └── index.json
│ │ ├── AccountService.json
│ │ │ └── index.json
│ │ ├── AccountService.v1_0_0.json
│ │ │ └── index.json
│ │ ├── AccountService.v1_0_2.json
│ │ │ └── index.json
│ │ ├── AccountService_v1.xml
│ │ │ └── index.xml
│ │ ├── AttributeRegistry.json
│ │ │ └── index.json
│ │ ├── AttributeRegistry.v1_0_0.json
│ │ │ └── index.json
...
Instead of
│ ├── Schemas
│ │ ├── AccountService.1.0.0.json
│ │ ├── AccountService.json
│ │ ├── AccountService.v1_0_0.json
│ │ ├── AccountService.v1_0_2.json
│ │ ├── AccountService_v1.xml
│ │ ├── AttributeRegistry.json
│ │ ├── AttributeRegistry.v1_0_0.json
...
As it seems inconvenient for those who may just have wanted to curl/get the files themselves, and have to place them in these directories.
I'm working on hooking up the mockup server to a test program which supports Actions, only to find that do_POST seems to support Collections only.
The request would be something like
curl http://localhost:8000/redfish/v1/Systems/1/Actions/ComputerSystem.Reset -d '{"ResetType":"ForceOn"}'
where the corresponding index.json is defined as:
redfish/v1/Systems/1/index.json
"Actions": {
"#ComputerSystem.Reset": {
"[email protected]": [
"On",
"ForceOff",
"ForceOn",
"ForceRestart"
],
"target": "/redfish/v1/System/1/Actions/ComputerSystem.Reset"
}
},
The curl request returns 404 since do_POST() doesn't have logic for actions. Is that a feature planned to be added?
I launch the server and run some request against it.
But after a while, the server cannot response to my query any more.
In the console, I found the following error msg
I am not sure how to troubleshooting this issue and more importantly how to aviod this happening ?
('GET', '/redfish/v1/Systems/1/Processors/1')
GET: Headers: Host: 172.29.128.210
Accept-Encoding: identity
('GET', '/redfish/v1/Systems/1/Processors/2')
GET: Headers: Host: 172.29.128.210
Accept-Encoding: identity
File "/usr/local/lib/python3.8/site-packages/gevent/_socketcommon.py", line 392, in _sendall
timeleft = __send_chunk(socket, chunk, flags, timeleft, end)
File "/usr/local/lib/python3.8/site-packages/gevent/_socketcommon.py", line 321, in __send_chunk
data_sent += socket.send(chunk, flags)
File "/usr/local/lib/python3.8/site-packages/gevent/_socket3.py", line 515, in send
return self._sock.send(data, flags)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------
10.244.1.1 - - [16/Nov/2020 03:34:41] "GET /redfish/v1/Chassis HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('10.244.1.1', 34169)
Traceback (most recent call last):
File "/usr/local/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/lib/python3.8/socketserver.py", line 347, in process_request
self.finish_request(request, client_address)
File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python3.8/socketserver.py", line 720, in __init__
self.handle()
File "/usr/local/lib/python3.8/http/server.py", line 427, in handle
self.handle_one_request()
File "/usr/local/lib/python3.8/http/server.py", line 415, in handle_one_request
method()
File "./redfishMockupServer.py", line 376, in do_GET
self.end_headers()
File "/usr/local/lib/python3.8/http/server.py", line 529, in end_headers
self.flush_headers()
File "/usr/local/lib/python3.8/http/server.py", line 533, in flush_headers
self.wfile.write(b"".join(self._headers_buffer))
File "/usr/local/lib/python3.8/socketserver.py", line 799, in write
self._sock.sendall(b)
File "/usr/local/lib/python3.8/site-packages/gevent/_socket3.py", line 534, in sendall
return _socketcommon._sendall(self, data_memory, flags)
File "/usr/local/lib/python3.8/site-packages/gevent/_socketcommon.py", line 392, in _sendall
timeleft = __send_chunk(socket, chunk, flags, timeleft, end)
File "/usr/local/lib/python3.8/site-packages/gevent/_socketcommon.py", line 321, in __send_chunk
data_sent += socket.send(chunk, flags)
File "/usr/local/lib/python3.8/site-packages/gevent/_socket3.py", line 515, in send
return self._sock.send(data, flags)
ConnectionResetError: [Errno 104] Connection reset by peer
When querying the mockup server for NVMe drives, the drives only have an @odata.id
field with no other fields:
>>> import redfish
>>> con = redfish.redfish_client(base_url="http://127.0.0.1:8000")
>>> drives = con.get("/redfish/v1/Systems/AccessModule1/Storage/NVMe?expand=.($levels=1)", None).obj.Drives
>>> drives[0]
{'@odata.id': '/redfish/v1/Chassis/Chassis/Drives/0'}
Contrast this with a real server:
>>> import redfish
>>> con = redfish.redfish_client(base_url="https://real-redfish-server")
>>> con.login()
>>> drives = con.get("/redfish/v1/Systems/AccessModule1/Storage/NVMe?expand=.($levels=1)", None).obj.Drives
>>> drives[0].keys()
dict_keys(['@odata.context', '@odata.type', '@odata.id', 'Id', 'Name', 'Status', 'PhysicalLocation', 'Links', 'Oem', 'MediaType', 'Protocol', 'Model', 'Manufacturer', 'PartNumber', 'SerialNumber', 'CapacityBytes', 'CapableSpeedGbs', 'Revision', 'PredictedMediaLifeLeftPercent', 'IndicatorLED', 'Assembly'])
Need support for Telemetry model SubmitTestMetricReport Action. The MetricReport JSON document generated from Action parameters should be sent to any Subscriber and the generated report should be persisted in the TelemetryService.MetricReports collection (in memory only). Only the last version of a specific MetricReport (based on the MetricReport Name) should be persisted.
When using a mockup that contains header files, we need to strip out ones that specify chunking.
redfishMockupServer.py has inconsistent indentation. Sometimes indents are 4 spaces, while other times they're 8 spaces.
Example:
def dict_merge(dct, merge_dct):
"""
https://gist.github.com/angstwad/bf22d1822c38a92ec0a9 modified
Next function immediately after that:
def clean_path(path, isShort):
"""clean_path
We would really really appreciate it if you could please publish the redfish server image for Windows as well, maybe under a different docker tag (e.g. -windows
). Because we use azure devops and we only use Window CI agent.
This is a the error we get when we try to run the redfish server on Windows
docker: image operating system "linux" cannot be used on this platform: operating system is not supported.
hi,
in the README the command after "Build a container from GitHub:" says
docker build -t dmtf/redfish-mockup-server:latest https://github.com/DMTF/Redfish-Mockup-Server.git
which defaults to the master
branch, but the repo has a main
branch, the right command should probably be:
docker build -t dmtf/redfish-mockup-server:latest "https://github.com/DMTF/Redfish-Mockup-Server.git#main"
I'm attempting to use Node to send a POST request to /redfish/v1/EventService/Subscriptions
with the following body:
EventDestination: {
EventFormatType: "MetricReport",
SubscriptionType: "RedfishEvent",
Destination: "http://localhost:8080/api/event_in"
}
}
I'm assuming something is wrong with my body format but I pulled this from the EventDestination schema. I'm getting a 204 response from RMS and am expecting a 201.
For the full function, see line 272-290 at https://github.com/andrewbossie/SER401-Redfish/blob/US-51-aantes/rfInsight/controllers/RoutesController.js
Give a proper response to imrproper formatted Actions, such as invalid JSON or missing parameters (consult HTTP return codes and return headers in these cases)
except KeyboardInterupt:
pass
Above code (line# 486) need to change as follows
except KeyboardInterrupt:
pass
Missed the letter 'r'
Reference : https://docs.python.org/3/library/exceptions.html#KeyboardInterrupt
With the DMTF setting HTTPS as the default for Redfish, feel it would be essential to have HTTPS support added to the mockup. Currently it does support only HTTP and not HTTPS.
If a mockup contains an event service, it would be good for the mockup server to allow clients to add new event subscriptions to the EventDestinationCollection, and allowing a client to leverage the SubmitTestEvent action to support event reception testing.
By Redfish spec, the program should send a "Location" header item of the new URI.
Real server returns an ETag for accounts, and later expects the current ETag in PATCH request headers. The mock server does not return such a header at all.
>>> real_resp = real_server.get("/redfish/v1/AccountService/Accounts/0")
>>> print(real_resp.getheader("ETag"))
W/"F42F8DCB"
>>> mock_resp = mock.server.get("/redfish/v1/AccountService/Accounts/0")
>>> print(mock_resp.getheader("ETag"))
None
Question:
I noticed that CORS (Cross-origin Resource Sharing) support has been removed silently in version 1.0.9. This feature allows JavaScript GUI simulators calling the Redfish-Mokcup-Server and providing a full BMC simulator (GUI + Redfish service).
Any chance to have it back ?
Thanks.
I have a local instance of the Redfish Mockup Server. I am running it on Windows 11, my firewall is disabled and I tried it with the Windows' SSDP Service on and off.
This is my client code:
// file Program.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
builder.Services.AddHostedService<RedfishServerDiscoveryService>();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseStaticFiles();
app.UseRouting();
app.MapRazorPages();
app.Run();
public class RedfishServerDiscoveryService : BackgroundService
{
private readonly ILogger<RedfishServerDiscoveryService> _logger;
public RedfishServerDiscoveryService(ILogger<RedfishServerDiscoveryService> logger)
{
_logger = logger;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
// Send an SSDP search message to the network to discover Redfish servers
var ssdpMessage = "M-SEARCH * HTTP/1.1\r\n" +
"HOST: 239.255.255.250:1900\r\n" +
"MAN: \"ssdp:discover\"\r\n" +
"ST: urn:dmtf-org:service:redfish-rest:1\r\n" +
"MX: 5\r\n" +
"\r\n";
var ssdpBytes = Encoding.UTF8.GetBytes(ssdpMessage);
var ssdpEndpoint = new IPEndPoint(IPAddress.Parse("239.255.255.250"), 1900);
using (var udpClient = new UdpClient())
{
udpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
udpClient.JoinMulticastGroup(IPAddress.Parse("239.255.255.250"));
while (!stoppingToken.IsCancellationRequested)
{
try
{
await udpClient.SendAsync(ssdpBytes, ssdpBytes.Length, ssdpEndpoint);
_logger.LogInformation("Sent SSDP search message to discover Redfish servers.");
var receiveTask = udpClient.ReceiveAsync();
if (await Task.WhenAny(receiveTask, Task.Delay(TimeSpan.FromSeconds(10))) == receiveTask)
{
var response = receiveTask.Result;
var responseMessage = Encoding.UTF8.GetString(response.Buffer);
_logger.LogInformation($"Received SSDP response from {response.RemoteEndPoint}: {responseMessage}");
}
else
{
_logger.LogInformation("No SSDP response received from Redfish servers.");
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error discovering Redfish servers using SSDP.");
}
}
}
}
}
expected behavior: The Mockup Server should respond to the SSDP messages
actual behavior: The Mockup Server does not respond the messages
Would like to have the mockup server support receiving SSDP requests and sending responses back.
PR #71 implemented only basic expand query functionality
it doesn't handle LEVELS and LINKS yet
This issue is tracking future work to add those capabilities
option -P does not work for Redfish Mockup Server, version 1.0.7 . It gives the following error:
sh-4.2# python redfishMockupServer.py -H 172.17.0.8 -P 8003
redfishMockupServer.py
Redfish Mockup Server, version 1.0.7
program: redfishMockupServer.py
Hostname: 172.17.0.8
Port: 8000
dir path specified by user:None
response time: 0 seconds
Serving Mockup in abs real directory path:/RGB-telemetry/Redfish-Mockup-Server
Traceback (most recent call last):
File "redfishMockupServer.py", line 755, in
main(sys.argv)
File "redfishMockupServer.py", line 732, in main
fpath = myServer.construct_path('/redfish/v1', 'index.json')
AttributeError: 'HTTPServer' object has no attribute 'construct_path'
sh-4.2# python redfishMockupServer.py -H 127.0.0.1 -P 8000
redfishMockupServer.py
Redfish Mockup Server, version 1.0.7
program: redfishMockupServer.py
Hostname: 127.0.0.1
Port: 8000
dir path specified by user:None
response time: 0 seconds
Serving Mockup in abs real directory path:/RGB-telemetry/Redfish-Mockup-Server
Traceback (most recent call last):
File "redfishMockupServer.py", line 755, in
main(sys.argv)
File "redfishMockupServer.py", line 732, in main
fpath = myServer.construct_path('/redfish/v1', 'index.json')
AttributeError: 'HTTPServer' object has no attribute 'construct_path'
sh-4.2# python redfishMockupServer.py -H 172.17.0.8
redfishMockupServer.py
Redfish Mockup Server, version 1.0.7
program: redfishMockupServer.py
Hostname: 172.17.0.8
Port: 8000
dir path specified by user:None
response time: 0 seconds
Serving Mockup in abs real directory path:/RGB-telemetry/Redfish-Mockup-Server
Serving Redfish mockup on port: 8000
running Server...
Hi,
I tried to use the Redfish-Mockup-Server with a mockup I created with Redfish-Mockup-Creator, but ran into some problems with my HTTP client by Chilkat (3rdparty library).
When trying to get a response from the mockup server, I succesfully retrieve the response but without body.
Chilkat stopped reading the body after the headers since neither Transfer-Encoding nor Content-Length was specified.
As far as I understood the HTTP RFCs correctly (but I could be wrong of course!) - you either have to specify a Content-Length
or Transfer-Encoding: chunked
for HTTP 1.1 responses?
After quick&dirty hacking the Content-Length header in in "None-Headerfile-Response-Mode" it worked for me.
Can you add the Content-Length header for responses in general?
I've discovered that the mockup server will get stuck in an infinite loop (at line 136) if a POST request triggers adding a new member. This occurs under the following conditions:
public-rackmount1
example schema:"Members": [
{
"@odata.id": "/redfish/v1/SessionService/Sessions/1234567890ABCDEF"
}
]
I created a PR to fix this (#100). It should always generate a unique "Id" whenever any Member is added, but also maintains previous functionality.
I'm getting an unhandled exception when attempting to send a PATCH request to the Redfish Mockup Server via Node JS. See the console output below.
content-type: application/x-www-form-urlencoded
accept: application/json
content-length: 25
Connection: close
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 51888)
Traceback (most recent call last):
File "Z:\Python\lib\socketserver.py", line 317, in _handle_request_noblock
self.process_request(request, client_address)
File "Z:\Python\lib\socketserver.py", line 348, in process_request
self.finish_request(request, client_address)
File "Z:\Python\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "Z:\Python\lib\socketserver.py", line 696, in __init__
self.handle()
File "Z:\Python\lib\http\server.py", line 418, in handle
self.handle_one_request()
File "Z:\Python\lib\http\server.py", line 406, in handle_one_request
method()
File "redfishMockupServer.py", line 226, in do_PATCH
dataa = json.loads(self.rfile.read(lenth).decode("utf-8")) # Error is here
File "Z:\Python\lib\json\__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "Z:\Python\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "Z:\Python\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
----------------------------------------```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.