Age | Commit message (Collapse) | Author | Files | Lines |
|
event_service_manager.hpp contains namespace 'event_log' which is
confusing. Extract it to a separate header and cpp file to have the
filename match the namespace.
No functional changes have been made to the code.
Tested:
- Using Redfish Event Listener, test subscriptions and eventing.
- Redfish Service Validator passes
Change-Id: Ia0bf658b8b46f92aede059d46e8de48f160e073e
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
'class Subscription' can be extracted into a separate file.
No changes have been made to the code.
Tested:
- Using Redfish Event Listener, test subscriptions and eventing.
- Redfish Service Validator passes
Change-Id: Id0076ef617e36cbb85629a386a4511a4fdb5e4da
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
|
|
This commit contains the redfish error to be returned when it finds
that MFA is enabled and the user has to generate secret key to proceed
further.
Used and tested in https://gerrit.openbmc.org/c/openbmc/bmcweb/+/74938.
Change-Id: If13b96729510fc7b165aa792f1e1d23a811ca733
Signed-off-by: Jishnu CM <jishnunambiarcm@duck.com>
|
|
Fix the following clang-tidy errors:
```
../redfish-core/src/filter_expr_executor.cpp:102:21: error: no header providing "nlohmann::json" is directly included [misc-include-cleaner,-warnings-as-errors]
7 | const nlohmann::json& body;
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2e0d66bb35c1010607b9795d00b3321dc20d6d65
|
|
This adds the additional format for ISO 8601, such as YYYYMMDD or
YYYYMMDDThhmmssZ.
Tested:
Test case 1:
The input ISO 8601 timestamp: 20230531T000000Z
The output Epoch timestamp: 1685491200000000
Test case 2:
The input ISO 8601 timestamp: 20230531
The output Epoch timestamp: 1685491200000000
Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com>
Change-Id: I23080a466b2edeecb5d8a4fb7ec0b00739454056
|
|
Static analysis flags that these two comments are redundant[1], which
seem to be duplicated a lot in copyright headers. Although there is a
larger discussion that can likely be had.
[1] https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&id=edtanous_bmcweb&open=AY9_HYjgKXKyw1ZFwgVP
Tested: Comment change only. Code compiles.
Change-Id: Ia960317761f558a87842347ca0b5f3da63f8e730
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Similar to what we've done elsewhere, break out hostlogger into its own
file.
Tested: Code compiles.
Change-Id: Ib9a48577878f57eb7ed4e3cf6b84a58a3ec203f6
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Similar to other patches, break out the post codes log services into
their own file. log_services.hpp is far too large.
Change-Id: I3cb644d52a9d3b5f9a15a2f90c1b69c87491e5c8
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
These were added as part of
d5c80ad9c07b94465d8ea62d2b6f87c30cac765e: test treewide: iwyu
Since then, Nan hasn't been very active on the project, and to my
knowledge, since the initial run, we've never used IWYU again.
clang-include-cleaner seems to work well without needing these pragmas,
and is what we're using, even if it's less useful than IWYU.
Remove all mention of IWYU.
Tested: Code compiles.
Change-Id: I06feedeeac9a114f5bdec81d59ca83223efd8aa7
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
This commit is automatically generated by enabling clang-include-fixer.
Tested: Code compiles.
Change-Id: I475d7b9d43e95bbdeeaadf11905d3b2a60aa8ef3
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
PropertyError is defined in the DMTF schemas, and will be used in
the next patchset.
Tested: Code compiles. No functional changes.
Change-Id: Ib5f0e2025e07c9add41e5e8df8288d7e54104ee7
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
It was correctly pointed out that for PATCH, we cannot return 200
success without also returning the object, per Redfish. This commit
partially reverts cdf25ff, to give PATCH the old (204) behavior again.
Tested: Patch now returns 204
Change-Id: I8ede932a73ae064586d94c47393e4418350adb00
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Today to determine if the hypervisor computer system resource should be
added to the System Collection a call to the Settings Manager is made.
Based on discussion in
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/73203 and to help the
multihost stuff move forward, lets move this hypervisor under a meson
option which any company that needs can enable. I think IBM is the only
one who uses this so the risk of breaking someone should be small.
One day hope to converge at some point, this probably doesn't happen
until after the multihost stuff goes in.
This is also better for implementations that don't have this backend
because now routes like
/redfish/v1/Systems/hypervisor/EthernetInterfaces/ aren't put out. I.e.
a call to /redfish/v1/Systems/hypervisor/EthernetInterfaces/ is now
going to return 404 instead of 500 on systems without this backend
support.
Tested: Enabled this and see the hypervisor system. Without this enabled
do not see the hypervisor system. No new validator errors either way.
Change-Id: Ie05e6644dd6f640cf8225f96becb99b9c2d0de20
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
|
|
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
|
Both 200 and 204 are allowed by the Redfish specification. Table 11
states:
200 OK Success, and the action's schema definition does not contain an
action response.
204 No Content: Success, and the action's schema definition does not
contain an action response.
While both of these are allowed, we accidentally changed behavior in the
following commit:
87c4496 Move to Redfish setProperty call
When we transitioned these over to the common dbus calling methods.
This commit restores the old behavior of returning 200 success on
actions, which some implementations are expecting.
Tested: WIP.
Change-Id: I02e47585acf85bd04dcb9d428ef3e39a21d9c75f
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
The alternative routes declared depending on BMCWEB_REDFISH_DBUS_LOG can
be closer together. This makes the route declarations more readable.
Tested: no, simple code move
Change-Id: Ia296a3391cc8476b4fa4a1198a7005aab000b4fa
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
|
|
/redfish/v1/odata/index.json was inadvertently moved to be not
installed in
a529a6aa44e04ae5845d1324f3e8c887ebd47f7b
This file is basically unused, and even this author doesn't understand
what it's used for, but it is technically required in the spec, so add
it back using a runtime derived handler.
Tested:
Get /redfish/v1/odata returns the appropriate struct.
Change-Id: I548abbdd9f0b1eb28299165202626feede41e363
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
The Redfish spec require filtering of SSE entries to be supported.
This commit rearranges the code, and implements SSE sorting as well
as support for Last-Event-Id. To do this it adds a dependency on
boost circular_buffer.
Tested:
SSE connections succeed. Show filtered results.
Change-Id: I7aeb266fc40471519674c7b65cd5cc4625019e68
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Like we've done other places, make log services journal follow the
naming convention, and break down lambdas into actual methods.
This is a refactor not intended to make any functional changes.
Tested: Redfish service validator passes. Journal works as before.
Change-Id: Ibbc7a13fba9c63606f7fd9c741af3b296633b664
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
log_services.hpp probably shouldn't have been allowed to get as large
as it has. This commit starts by breaking out functions from
log_services.hpp, and moves them to manager_logservices_journal.hpp.
Code is moved as-is with no functional changes.
Tested: Journal GET works as before. Redfish service validator passes.
Change-Id: I93c372ae3e39967e1b0eaf0cf496f84ac4114b5c
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Filter allows comparing certain strings as numeric greater than or less
than operators. The most obvious example of this is something like
\$filter=Created gt <timestamp>
Because internally timestamps are treated as strings, this requires
including and parsing out the timestamps again, which we have utilities
for.
In addition, "fuzzy" string comparisons, like
GPU_2 gt GPU_1
Should also be supported.
Tested: Unit tests pass
Change-Id: I39fc543921ed8cc93664d9cf297dad8ee902b68f
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Previously, the parser added space ignore instructions between every
node. This is because there was one place where we actually cared about
spaces, when doing operator comparisons (x eq y). If spaces are
ignored, it's impossible to determine the end of x and the beginning of
eq.
Spirit x3 has a lexeme, which allows us to ignore the parser skips
temporarily, which allows us to parse the operations in a much simpler
way. This also requires that we change to phrase_parse instead of
parse.
Tested: Unit tests pass. Good coverage.
Change-Id: Ifc6f1681e8524ba5032ee118cc3b3a18b30c639e
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
$filter is a parameter documented in the Redfish specification, section
7.3.4. It defines a mechanism for filtering arbitrary collections of
parameters based on a set of arbitrary language expressions.
From the specification, it supports the following language operators:
() Precedence grouping operator.
(Status/State eq 'Enabled' and Status/Health eq 'OK')
or SystemType eq 'Physical'
and Logical and operator.
ProcessorSummary/Count eq 2 and MemorySummary/TotalSystemMemoryGiB gt 64
eq Equal comparison operator.
ProcessorSummary/Count eq 2
ge Greater than or equal to comparison operator.
ProcessorSummary/Count ge 2
gt Great than comparison operator.
ProcessorSummary/Count gt 2
le Less than or equal to comparison operator
MemorySummary/TotalSystemMemoryGiB le 64
lt Less than comparison operator.
MemorySummary/TotalSystemMemoryGiB lt 64
ne Not equal comparison operator.
SystemType ne 'Physical'
not Logical negation operator.
not (ProcessorSummary/Count eq 2)
or Logical or operator.
ProcessorSummary/Count eq 2 or ProcessorSummary/Count eq 4
Support for these operators have been added in previous commits. This
commit enables them behind the insecure-enable-redfish-query meson
option. This is an arbitrary language, so the likelihood there's some
improper implementation in the patch is high. This gives folks the
ability to test it.
Tested:
Lots of unit tests included in this patch.
Functionally tested the basic operators:
```
GET /redfish/v1/Managers/bmc/LogServices/Journal/Entries?\$filter=EntryType+eq+'Oem'
GET /redfish/v1/Managers/bmc/LogServices/Journal/Entries?\$filter=EntryType+ne+'Oem'
```
Function as expected, producing multiple results or no results
respectively.
GET /redfish/v1 reports "FilterQuery": true
Redfish service validator passes.
Change-Id: Id568acc5dcfce868af12da5ee16c4f0caae8060a
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
This commit implements a parser for $filter expressions, per the redfish
specification and odata specification. This is intended to be used to
support $filter query for collections.
For parsing libraries, this commit chooses boost spirit x3. It's chosen
because it doesn't require a new external dependency, and is done
entirely in the compiler, using C++ syntax. While the syntax is still
somewhat difficult to read, there's a slew of unit tests included to
make sure that at least the common things we expect to work will parse
correctly.
Tested: Unit tests pass (good coverage). Code not yet used.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1b0ab615bc49064acab4dad47f0a8aa499557bfc
|
|
One of Telemetry service's triggers' action is logging events to Redfish
log [1][2]. This change appends messages from DMTF schema [3] to
registry collection, so that they become available for Telemetry
service.
Tested:
- Telemetry subset present under /redfish/v1/Registries
- Telemetry registry details present under
/redfish/v1/Registries/Telemetry
- Telemetry messages present under
/redfish/v1/Registries/Telemetry/Telemetry
- Telemetry messages appear in event log
(/redfish/v1/Systems/<str>/LogServices/EventLog/Entries) after being
sent using phosphor-logging
[1] https://github.com/openbmc/docs/blob/master/designs/telemetry.md?plain=1#L423-L426
[2] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Telemetry/Trigger.interface.yaml#L61-L62
[3] https://redfish.dmtf.org/registries/Telemetry.1.0.0.json
Change-Id: Ic0b82c695fc7755394becd120c301b6056e3ce19
Signed-off-by: Michal Orzel <michalx.orzel@intel.com>
|
|
nlohmann::json::items() throws an exception if the object in question is
not a json object. This has the potential to cause problems, and isn't
in line with the standard that we code against.
Replace all uses of items with iterating the nlohmann::json::object_t.
This adds a new error check for pulling the object_t out of the
nlohmann::json object before each iteration, to ensure that we're
handling errors.
Tested: Redfish service validator passes.
Change-Id: I2934c9450ec296c76544c2a7c5855c9b519eae7f
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
This is a method that exists in the base registry that we will use in
the next commit.
Tested: Code compiles. Code is not yet used.
Change-Id: I02e81371adeb8d3e2c2515a8af94b9a1ac0973a9
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
In the initial implementation of metadata indexing the bmc knew at
compile time what schemas it could potentially publish. bmcweb took the
approach of adding all schemas of all versions to the $metadata
resource. Since that was made, two major changes have happened.
First, Redfish has added significantly more versions of each schema, as
well as significantly more schemas to the point where the metadata index
is now 213KB. While this file compresses fairly well, the size is
obvious from the large amount of time that redfish service validator
takes to parse the schemas, compared to actually acquiring BMC redfish
resources.
Second, aggregation was added, where an aggregated Redfish service might
implement any number of schemas, including OEM ones.
In an effort to fix this, this patch takes the compile-time algorithm in
update_schemas.py, and moves it into bmcweb itself, parsing the files on
disk as needed on demand. This has some immediate benefits; First, is
that now schemas can be potentially installed from anywhere, not only
from within the bmcweb build, and they will be resolved at runtime.
Second, patches that want to add support for a given schema need to only
symlink the schema into the correct folder, without needing to rerun
update_schemas.py. This saves time in review.
Finally, this opens to door to reducing the schema versions present in
the metadata to the unique set of only what this bmcweb instance, and
its aggregated BMCs expose.
Tested: Redfish service validator passes. Need A/B checking to verify
the file is byte for byte the same.
GET /redfish/v1/$metadata returns what looks like sane results, with a
correct content-type.
Unit tests require the use of TemporaryFileHandle, so that class is
moved into a more general folder, outside of test/http.
Change-Id: I326159099c6b6c4056023b2e173c5f074ed88ce1
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
25b54db introduced an inadvertent inversion in options. Admittedly,
this option (redfish-dbus-entries) chose to override URLs instead of
creating new ones, which makes it incompatible. Normally we'd require
unique URIs for each entry to make this error not possible, and I
believe that this is the only instance of us registering two handlers
for one url/verb.
Tested: Romulus now boots and functions in qemu. GET /redfish/v1
returns results.
Change-Id: I6125a5a0242b6cfc54ff19866665227c97f45d0a
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
The configuration options that exist in bmcweb are an amalgimation of
CROW options, CMAKE options using #define, pre-bmcweb ifdef mechanisms
and meson options using a config file. This history has led to a lot of
different ways to configure code in the codebase itself, which has led
to problems, and issues in consistency.
ifdef options do no compile time checking of code not within the branch.
This is good when you have optional dependencies, but not great when
you're trying to ensure both options compile.
This commit moves all internal configuration options to:
1. A namespace called bmcweb
2. A naming scheme matching the meson option. hyphens are replaced with
underscores, and the option is uppercased. This consistent transform
allows matching up option keys with their code counterparts, without
naming changes.
3. All options are bool true = enabled, and any options with _ENABLED or
_DISABLED postfixes have those postfixes removed. (note, there are
still some options with disable in the name, those are left as-is)
4. All options are now constexpr booleans, without an explicit compare.
To accomplish this, unfortunately an option list in config/meson.build
is required, given that meson doesn't provide a way to dump all options,
as is a manual entry in bmcweb_config.h.in, in addition to the
meson_options. This obsoletes the map in the main meson.build, which
helps some of the complexity.
Now that we've done this, we have some rules that will be documented.
1. Runtime behavior changes should be added as a constexpr bool to
bmcweb_config.h
2. Options that require optionally pulling in a dependency shall use an
ifdef, defined in the primary meson.build. (note, there are no
options that currently meet this class, but it's included for
completeness.)
Note, that this consolidation means that at configure time, all options
are printed. This is a good thing and allows direct comparison of
configs in log files.
Tested: Code compiles
Server boots, and shows options configured in the default build. (HTTPS,
log level, etc)
Change-Id: I94e79a56bcdc01755036e4e7278c7e69e25809ce
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
In the change made to move to std::format, we defined some custom type
formatters in logging.hpp. This had the unintended effect of making
all compile units pull in the majority of boost::url, and nlohmann::json
as includes.
This commit breaks out boost and json formatters into their own separate
includes.
Tested: Code compiles. Logging changes only.
Change-Id: I6a788533169f10e19130a1910cd3be0cc729b020
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Most of these were found by breaking every redfish class handler into
its own compile unit:
When that's done, these missing headers become compile errors. We
should just fix them.
In addition, this allows us to enable automatic header checking in
clang-tidy using misc-header-cleaner. Because the compiler can now
"see" all the defines, it no longer tries to remove headers that it
thinks are unused.
[1] https://github.com/openbmc/bmcweb/commit/4fdee9e39e9f03122ee16a6fb251a380681f56ac
Tested: Code compiles.
Change-Id: Ifa27ac4a512362b7ded7cc3068648dc4aea6ad7b
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Similar to other refactorings we've been doing, make UpdateService call
into methods instead of inline lambdas.
Tested: Redfish service validator passes. Structural changes only.
Change-Id: I96b6db5e14fa0f7d357fb0faf63d0457b7963581
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
This commit changes sdbusplus setProperty calls (in various files) to
setDbusProperty method in Redfish namespace that handles all DBus
errors in a consistent manner.
It also handles and translates additional DBus errors to Redfish
specific errors in dbus_utils file.
Tested By:
Not tested yet
Change-Id: If440774879413754f4c24f9b6572c3c9fa1fd033
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
|
|
Despite these objects being called "view" they are still relatively
large, as clang-tidy correctly flags, and we ignore.
Change all function uses to capture by:
const boost::urls::url_view_base&
Which is the base class of all boost URL types, and any class (url,
url_view, etc) is convertible to that base.
Change-Id: I8ee2ea3f4cfba38331303a7e4eb520a2b6f8ba92
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Meson supports unity builds[1] natively. There's no reason to continue
with the pseudo unity build we've been using by putting implementations
in header files.
This commit is the first in a long series of starting to break this up
into smaller compile units, in the hopes of dropping incremental compile
times for developers, and reduce the total per-core memory usage that
gcc requires.
This commit breaks out the run() function from main() and the
constructor of RedfishService from redfish.hpp into their own compile
units. According to tracing, even after broken out, these are still by
far the two longest to compile units in the build.
Tested: Code compiles. Debug build on a 24 core build server results in
a decrease in compile time for compiling just bmcweb from 1m38s to
1m22s.
[1] https://mesonbuild.com/Unity-builds.html
Change-Id: Ibf352e8aba61d64c9a41a7a76e94ab3b5a0dde4b
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
This commit will migrate all the setProperty calls initiated by a
redfish"Action" to "setDbusProperty" method in Redfish namespace that
handles all DBuserrors in a consistent manner.
This method will determine if a setProperty is called during redfish
"Action" or just setting of a dbus property and internally call
appropriate methods that handles different set of errors.
All the Redfish action specific errors are defined in error_messages.hpp
file.
This specific change moves setProperty call in hypervisor_system.hpp and
covers errors in the mentioned file only.
Tested-By:
<Yet to test this usecase>
Change-Id: I3da48fbeabcdcf088c4481021232f08a44797c86
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
There are currently 78 sdbusplus::asio::setProperty calls in
redfish-core. The error handler for nearly all of them looks something
like:
```
if (ec)
{
const sd_bus_error* dbusError = msg.get_error();
if ((dbusError != nullptr) &&
(dbusError->name ==
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
BMCWEB_LOG_WARNING("DBUS response error: {}", ec);
messages::propertyValueIncorrect(asyncResp->res, "<PropertyName>", <PropertyValue>);
return;
}
messages::internalError(asyncResp->res);
return;
}
messages::success(asyncResp->res);
```
In some cases there are more errors handled that translate to more error
messages, but the vast majority only handle InvalidArgument. Many of
these, like the ones in account_service.hpp, do the error handling in a
lambda, which causes readability problems. This commit starts to make
things more consistent, and easier for trivial property sets.
This commit invents a setDbusProperty method in the redfish namespace
that tries to handle all DBus errors in a consistent manner. Looking
for input on whether this will work before changing over the other 73
calls. Overall this is less code, fewer inline lambdas, and defaults
that should work for MOST use cases of calling an OpenBMC daemon, and
fall back to more generic errors when calling a "normal" dbus daemon.
As part of this, I've ported over several examples. Some things that
might be up in the air:
1. Do we always return 204 no_content on property sets? Today there's a
mix of 200, with a Base::Success message, and 204, with an empty body.
2. Do all DBus response codes map to the same error? A majority are
covered by xyz.openbmc_project.Common.Error.InvalidArgument, but there
are likely differences. If we allow any daemon to return any return
code, does that cause compatibility problems later?
Tested:
```
curl -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"HostName":"openbmc@#"}' https://192.168.7.2/redfish/v1/Managers/bmc/EthernetInterfaces/eth0
```
Returns the appropriate error in the response
Base.1.16.0.PropertyValueIncorrect
Change-Id: If033a1112ba516792c9386c997d090c8f9094f3a
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
And fix the includes that are wrong.
Note, there is a very large ignore list included in the .clang-tidy
configcfile. These are things that clang-tidy doesn't yet handle
well, like knowing about a details include.
Change-Id: Ie3744f2c8cba68a8700b406449d6c2018a736952
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Internally inside phosphor-time-manager, the elapsed(uint64) dbus call
just forwards the request directly to systemd after static casting to
int64_t (signed).
bmcweb should just call systemd directly, for several reasons.
phosphor-timesyncd might block on other calls, given it's a single
threaded blocking design, due to bugs like #264. Calling systemd
directly means that calls that don't require phosphor networkd won't be
blocked.
Calling systemd directly allows bmcweb to drop some code that parses a
date as int64_t, then converts it to uint64_t to fulfill the phosphor
datetime interface. We can now keep int64_t all the way through.
Calling systemd directly allows bmcweb to give a more specific error
code in the case there NTP is enabled, registering a
PropertyValueConflict error, instead of a 500 InternalError.
Tested:
Patching DateTime property with NTP enabled returns 400,
PropertyValueConflict
```
curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"DateTime":"2020-12-15T15:40:52+00:00"}' https://192.168.7.2/redfish/v1/Managers/bmc
```
Disabling NTP using the following command:
```
curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"NTP":{"ProtocolEnabled":false}}' https://192.168.7.2/redfish/v1/Managers/bmc/NetworkProtocol
```
Allows the prior command to succeed.
[1] https://github.com/openbmc/phosphor-time-manager/blob/5ce9ac0e56440312997b25771507585905e8b360/bmc_epoch.cpp#L126
Change-Id: I6fbb6f63e17de8ab847ca5ed4eadc2bd313586d2
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Changed the code to pass the parameters according to their types.
Tested: Code Compiles properly and tested.
Change-Id: Ie0e13d39cd892afda36dfabec871f0fe8d8498e4
Signed-off-by: Ginu George <ginugeorge@ami.com>
|
|
clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I2f9540cf0d545a2da4d6289fc87b754f684bc9a7
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
|
This code as it stands pulls in the full datetime library from boost,
including io, and a bunch of timezone code. The bmc doesn't make use of
any of this, so we can rely on a much simplified version.
Unfortunately for us, gcc still doesn't implement the c++20
std::chrono::parse[1]. There is a reference library available from [2]
that backports the parse function to compilers that don't yet support
it, and is the basis for the libc++ version. This commit opts to copy
in the header as-written, under the assumption that we will never need
to pull in new versions of this library, and will move to the std
ersion as soon as it's available in the next gcc version.
This commit simplifies things down to improve compile times and binary
size. It saves ~22KB of compressed binary size, or about 3%.
Tested: Unit tests pass. Pretty good coverage.
[1] https://en.cppreference.com/w/cpp/chrono/parse
[2] https://github.com/HowardHinnant/date/blob/master/include/date/date.h
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I706b91cc3d9df3f32068125bc47ff0c374eb8d87
|
|
In this commit the response code for the exceeding header size limit
during event subscription(post request to
/redfish/v1/EventService/Subscriptions) is changed to 400 (Bad
Request) instead of 405 (Method not allowed)
Tested:
If header size in post body is large(>8096), then response code is
returned as 400
Change-Id: Ie1301777c994dff64a49e625d7f4f7de72010610
Signed-off-by: Divya Jyoti <divya1.jyoti@intel.com>
|
|
C++20 brought us std::ranges for a lot of algorithms. Most of these
conversions were done using comby, similar to:
```
comby -verbose 'std::lower_bound(:[a].begin(),:[b].end(),:[c])' 'std::ranges::lower_bound(:[a], :[c])' $(git ls-files | grep "\.[hc]\(pp\)\?$") -in-place
```
Change-Id: I0c99c04e9368312555c08147d474ca93a5959e8d
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
std::format is a much more modern logging solution, and gives us a lot
more flexibility, and better compile times when doing logging.
Unfortunately, given its level of compile time checks, it needs to be a
method, instead of the stream style logging we had before. This
requires a pretty substantial change. Fortunately, this change can be
largely automated, via the script included in this commit under
scripts/replace_logs.py. This is to aid people in moving their
patchsets over to the new form in the short period where old patches
will be based on the old logging. The intention is that this script
eventually goes away.
The old style logging (stream based) looked like.
BMCWEB_LOG_DEBUG << "Foo " << foo;
The new equivalent of the above would be:
BMCWEB_LOG_DEBUG("Foo {}", foo);
In the course of doing this, this also cleans up several ignored linter
errors, including macro usage, and array to pointer deconstruction.
Note, This patchset does remove the timestamp from the log message. In
practice, this was duplicated between journald and bmcweb, and there's
no need for both to exist.
One design decision of note is the addition of logPtr. Because the
compiler can't disambiguate between const char* and const MyThing*, it's
necessary to add an explicit cast to void*. This is identical to how
fmt handled it.
Tested: compiled with logging meson_option enabled, and launched bmcweb
Saw the usual logging, similar to what was present before:
```
[Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled
[Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800
[Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist
[Info src/webserver_main.cpp:59] Starting webserver on port 18080
[Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file.
[Info src/webserver_main.cpp:137] Start Hostname Monitor Service...
```
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8
|
|
We have places where we explicitly set something to the pattern of
method(void)
This is no longer necessary to declare, so fix the places where we do
it to make the codebase consistent, and enable the check.
Tested: Clang-tidy passes.
Change-Id: I3ef03fc07d65b656fecbcfea638dd12ba95f22e0
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
clang-16 now supports std::source_location so remove the indirection
that uses experimental::source_location in some cases.
Tested: Compiled with `CXX=clang++`.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id55bdf01855206c6892684e1e56cc5ff56e2b5a2
|
|
Add a utility function which estimates the size of the JSON tree.
It is used in the children change to limit the reponse size of expand
query.
Tested:
1. unit test passed;
2. tested on hardware, the following are real sizes and estimation
```
Real payload size, Estimation, query
15.69 KB, 10.21 KB, redfish/v1?$expand=.($levels=1)
95.76 KB, 62.11 KB, redfish/v1?$expand=.($levels=2)
117.14 KB, 72.71 KB, redfish/v1?$expand=.($levels=3)
127.65 KB, 77.64 KB, redfish/v1?$expand=.($levels=4)
```
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Iae26d6732a6ec63ecc59eacf657b4bf33c07c046
|
|
The previous patches modified these fields one at a time, for the cases
where we had code calling these in odd ways. This commit goes and
effects the same change on the rest of the message handlers where it
makes sense.
Any input to a message function that mentions a "value" replaces the
value with a nlohmann::json object, to make calling this code easier.
The one exception is StringValueTooLong, which by definition, requires
the input value to be a string, so that is left as string_view
intentionally.
Tested: Dead unused code. Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I00b9804b2aadf5584032be91a0ee53b9a94a7430
|