Git Product home page Git Product logo

redfish-mockup-server's People

Contributors

bharadwaj-a avatar billdodd avatar birkneralex avatar drfleming0227 avatar flow86 avatar glimchb avatar jautor avatar metrowind avatar moshibin avatar mrabhiram avatar mraineri avatar nasimh avatar omnistat avatar pwvancil avatar rcherrueau avatar rite2hhh avatar robisonjoel avatar tomasg2012 avatar

Stargazers

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

Watchers

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

redfish-mockup-server's Issues

SSDP does not work

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

Content-Length header does not get generated/send

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?

Support POST as Redfish Actions

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?

Incorrect Behavior after doing a sequence of Post Delete Post operations on a collection

The collection is originally:
image
After doing a sequence of
Post {'a':1}
Delete /redfish/v1/Chassis/Blade1
Post {'b':2}
The collection becomes
image

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

Enhance fidelity of POST to Collection

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:

  1. Add Id, Name, @odata.id, and @odata.type properties to the newly created resource
  2. Return the new resource in the response body along with an HTTP 201 Created (instead of HTTP 204 No Content)

Add SubmitTestMetricReport Action

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.

Missing ETag support in AccountService

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

SSDP support

Would like to have the mockup server support receiving SSDP requests and sending responses back.

Version of Redfish Transport returns None

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.

Inconsistent indentation in redfishMockupServer.py

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

Subscription to EventService/Subscriptions - 204 response code

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

option --port does not work for Redfish Mockup Server, version 1.0.7

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...

Remove "@Redfish.Copyright" from payloads

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.

Docker: Handle signals

docker-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).

Run Server

$ 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 commands

$ 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

SSL with self-signed certificate issue

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
image

logs:
image

AttributeError: module 'ssl' has no attribute 'wrap_socket'

| 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

PATCH request exception

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)
----------------------------------------```

CORS support

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.

NVMe drives are returning only @odata.id in expand query, no other fields

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'])

Expand Query Enhanced support

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

Blade System Mockup Server

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.

no server response with exception

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

Request: Docker image for windows under different tag

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.

Mockup Server does not serve xml/json URIs as is

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.

POST to Collection logic incorrectly skipped

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

Unable to load mockup pages in certain browsers

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

Bug: Server gets stuck in an infinite loop when adding a member with no Id.

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:

  • When a POST is sent with no "Id" in the body, but a member at the URI exists with no number at the end. The regex on line 133 is unable to create a pattern template from the existing member, causing it to get stuck. This can occur easily when requesting a Session using the public-rackmount1 example schema:
"Members": [
        {
            "@odata.id": "/redfish/v1/SessionService/Sessions/1234567890ABCDEF"
        }
]
  • When a POST is sent with an "Id" specified in the body that already exists in Member (that it can't template). This is less likely to happen as you usually wouldn’t POST with an "Id".

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.

Support for HTTPS to be added

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.

Request to add SSE support

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.

Build a container from GitHub command points to wrong branch (master instead of main)

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"

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.