| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit contains bug fixes in readJson function call
1) Handled invalid double value which is leading to crash
bmcweb. If user give string for double value key, its
not handled in readJson which intern causes exception
and crash.
2) If any of input types of floating_point, signed or unsigned
int type values are provided with wrong type, it should
return error, instead its returning 200 success response.
Added code to return proper error response.
Tested:
- Tested invalid case by giving wrong type values in PATCH.
URI: /redfish/v1/Chassis/WC_Baseboard/Thermal
METHOD: Patch
REQUEST:
{
"Fans": [
{
"MemberId": "Fan_1a",
"Reading": "200"
}
]
}
RESPONSE:
{
"Reading@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "The value \"200\" for the property Reading is of a different type than the property can accept.",
"MessageArgs": [
"\"200\"",
"Reading"
],
"MessageId": "Base.1.4.0.PropertyValueTypeError",
"Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed.",
"Severity": "Warning"
}
]
}
- Also performed some positive and negative tests with other URI's.
- Redfish validator ran successfully without any issue(No impact though)
Change-Id: Ie98384e67a863ab96aa537f492a686b2c7ebb3a2
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recently, a number of people in the community have made the (admittedly
easy) mistake that we use a significant portion of crow.
Today, we use crow for the router, and the "app" structure, and even
those have been significantly modified to meet the bmc needs. All other
components have been replaced with Boost beast. This commit removes the
crow mentions from the Readme, and moves the crow folder to "http" to
camouflage it a little. No code content has changed.
Tested:
Code compiles. No functional change made to any executable code.
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Change-Id: Iceb57b26306cc8bdcfc77f3874246338864fd118
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
using the list of warnings from here:
https://github.com/lefticus/cppbestpractices/blob/e73393f25a85f83fed7399d8b65cb117d00b2231/02-Use_the_Tools_Available.md#L100
Seems like a good place to start, and would improve things a bit
type-wise. This patchset attempts to correct all the issues in one
shot.
Tested:
It builds. Will test various subsystems that have been touched
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Change-Id: I588c26440e5a97f718a0f0ea74cc84107d53aa1e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Given that very few people have actually needed to unpack a null value
with readJson, it's not surprising that there are bugs there.
the simplest case that failed was attempting to unpack an array which
might contain null values, which should be allowed to be unpacked with a
nlohmann::json object, to allow error handling and the new delete cases,
but were rejected.
Tested:
Reran the unit test here, which succeeded.
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/23954/2
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Change-Id: I50ae26645ad16f6a6228c27e6d501c08de4c622b
|
|
|
|
|
|
|
|
|
|
| |
Minor cleanup to a routine that allows us to drop one nullptr check.
Tested:
Will test shortly. Code should be no-op.
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Change-Id: I592dc0a9a311d6dd885cdd6289f343dd4b9b0567
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit d573bb2a regressed the PATCH operation
on the system redfish node. By initializing
result to no_content, the commit broke the subsequent
json_util::readJson, which checks if the result is "ok"
at the end of the function.
This commit fixes it by making readJsonValues() and its
descendants return a bool status. readJson() no longer
relies on the response object result to indicate success/
failure.
Tested:
-- Verified that PATCH operations on the system node now work.
-- Verified PATCH operations work on manager, accountservice and
ethernetinterfaces nodes.
-- No new errors from the Redfish validator.
Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: I54080392297a8f0276161da8b48d8f9518cbdcfe
|
|
|
|
|
|
|
|
|
|
|
| |
Adding boolean support in json_utils.
Test:
Validated by sending redfish POST/PATCH
request with boolean value in data.
Change-Id: Iddc7daebb3507a468cbb2187806908f821bd6da7
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
|
|
|
|
|
|
|
|
|
| |
Add support of reading floating point numbers.
Tested-by: Successfully unpacked doubles
Change-Id: I9cf5e33dbb99367a53013be28b8f905eae2e4518
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
| |
Add std::array support to readJson.
Change-Id: I32bb28908f195fd3443556c40b71eaabd105db25
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
| |
In certain cases, redfish wants to unpack specialized types that might
be more complex than just simple structs. This commit adds the ability
to unpack a nlohman json object directly, and moves the ethernet schema
over to the new api
Change-Id: Ib3c25e6c4d8f0a163647092adfb454355d329170
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Signed-off-by: James Feist <james.feist@linux.intel.com>
|
|
|
|
|
|
|
|
| |
This change is largely a sed replace, and gets us closer to standards
compliance.
Change-Id: Ie60437eff43de830ef19389344a55430dabd9d16
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds vector handling to the new json interface
and modifies the SendRawPECI Redfish command to utilize it.
Tested: Executed raw PECI commands with good and bad input
to check that it will work and error out correctly.
Change-Id: Ic1c837f5823d28555f727849156b4dabf1b8acef
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change allows numerical types to be passed to readJson
with the desired type. They will then be automatically
range-checked and cast to that type.
Tested: Requested variables of type uint64_t, uint8_t, int,
int16_t, and int8_t and confirmed that the range was correctly
checked for each.
Change-Id: Ia55cb03ba2c4321a7de35a7c7b566980a72c5449
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The error message code used a json_pointer object which must
begin with a '/' character and had to be sent as an extra
parameter. This change simplifies the interface by using a
string so there doesn't have to be a '/'. This allowed the
same property argument passed for the message to be used
for the property field path.
Tested: Sent an error with a property and verified that it is
correctly displayed.
Change-Id: I0571e2eee627cedf29d751588a4f1bceee66f084
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
|
|
|
|
|
|
|
|
|
| |
A small logic error caused bugs in the required-ness of optional params.
In the error case, a bad_request return code would be returned with no
error message. This commit allows the request to suceed unharmed.
Change-Id: I1c1cbaf08e79bc1f52485ae12d73701d74e0e2aa
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Makes the Redfish error reporting interface automatically handle
setting the http status and JSON content in the response object.
When using an AsyncResp object, this allows for simply calling
the Redfish error and returning.
Change-Id: Icfdce2de763225f070e8dd61e591f296703f46bb
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The existing way of decoding json structures, while fast has some disadvantages.
1. it's very verbose to write.
2. It requires in depth knowlege of redfish error messages to get
correct.
3. It _can_ lead to undesired behavior, like half of a patch being
applied, if only some of the values have bad types.
This commit implements a new interface for decoding redfish json
named.... readJson. It is a templated function, that lets you decode
json values based on type easily, while still handling all the correct
error codes that were handled previously. Use is done similar to the
example below:
std::string required;
boost::optional<std::string> optional;
if (!json_util::readJson(req, res, "OptionalParam", optional,
"RequiredParam", required))
{
return;
}
if (optional){
// optional param was given, take action.
}
As part of this patchset, the systems schema is moved to the new
interface, which deletes some of the code involved and shows the
improvement in clarity.
Change-Id: I041a97c84d294df8cd4de4c2702e5ee22c0bc120
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
|
|
|
|
|
|
|
|
| |
This commit moves the codebase to the lastest clang-format file from
upstream, as well as clang-format-6.0.
Change-Id: Ice8313468097c0c42317fbb9e10ddf036e8cff4c
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patchset moves bmcweb over to the upstream style naming
conventions for variables, classes, and functions, as well as imposes
the latest clang-format file.
This changeset was mostly built automatically by the included
.clang-tidy file, which has the ability to autoformat and auto rename
variables. At some point in the future I would like to see this in
greater use, but for now, we will impose it on bmcweb, and see how it
goes.
Tested: Code still compiles, and appears to run, although other issues
are possible and likely.
Change-Id: If422a2e36df924e897736b3feffa89f411d9dac1
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
|
|
These functions are not yet used, but will be required by at least two upcoming
patchsets. This functionality has been cut out from Configuration patchset for
easier merge without having to wait for that commit.
Change-Id: Ibe5d5cefd874d4a2d896b42a2b7cfc17480f3c5a
Signed-off-by: Kowalski, Kamil <kamil.kowalski@intel.com>
|