History log of /openbmc/bmcweb/include/openbmc_dbus_rest.hpp (Results 101 – 125 of 146)
Revision Date Author Comments
# f39420c7 30-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: sd_bus_message->JSON: fix multiple entries

When convertDBusToJSON processed an sd_bus_message with
a signature that had multiple high level entries, the
handler code tried to r

REST: sd_bus_message->JSON: fix multiple entries

When convertDBusToJSON processed an sd_bus_message with
a signature that had multiple high level entries, the
handler code tried to reassign a reference variable to
a new array entry, but references can't be reassigned,
so all it did was reset the passed in JSON object to
the empty value at the end of the array.

Instead, do this with a pointer.

Tested: A message with a signature of "sa{sv}as" was failing,
with nlohmann::json complaining about trying to do a
push_back on a string object. With this fix, that no longer
happens.

Change-Id: Idb3d3a56f0bd38f559f96f828ad95db65bbd11e1
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 62d2e8b6 22-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Return a 405 on bad DELETE paths

Return a method_not_allowed response when the path for a
DELETE is invalid. This matches what the phosphor-rest
server did.

Change-Id

REST: Return a 405 on bad DELETE paths

Return a method_not_allowed response when the path for a
DELETE is invalid. This matches what the phosphor-rest
server did.

Change-Id: I6db577d25d92bdbee9e97355ff11a15a5c68288b
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 39a4e39f 15-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: If necessary, combine method response data

There is a possibility that a method may be implemented
by either different services or interfaces, and 1 or more
of them may return

REST: If necessary, combine method response data

There is a possibility that a method may be implemented
by either different services or interfaces, and 1 or more
of them may return data.

In the unlikely case that is encountered, attempt to handle
that by first setting the final response data to the first
data back from a method, and then on future method responses
that return data:

* If the new and old responses are both dictionaries,
add the new keys/values to the original ones.

* If the new and old responses are both arrays,
add the new array elements to the original array.

* If the new data is of a different type than the
previous data, convert the overall response into
an array and add the new and original responses
as array elements.

Change-Id: I23edc3d9f8154aba1ba4276112cde6ecb4345fdf
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 89c1970b 14-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Add method return support for variants

Variants are in their own container. In order to
get the type of the data contained in the variant,
the peek API needs to be used.

REST: Add method return support for variants

Variants are in their own container. In order to
get the type of the data contained in the variant,
the peek API needs to be used.

Resolves openbmc/bmcweb#24

Change-Id: I085064a8eabe2f57cfa0f1977fe7b9c19baa80e2
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 75c6c67f 14-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Add method return support for structs

A struct is in its own sd_bus_message container,
and the output JSON looks like an array.

Change-Id: Ie8e5848a5fa9bc9605f5dda06dc1b5d

REST: Add method return support for structs

A struct is in its own sd_bus_message container,
and the output JSON looks like an array.

Change-Id: Ie8e5848a5fa9bc9605f5dda06dc1b5d7be4dea3c
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 6df8f990 14-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Add method return support for arrays/dicts

Add support for returning arrays and dictionaries
from methods.

Note that a dictionary can only be seen inside of
an array,

REST: Add method return support for arrays/dicts

Add support for returning arrays and dictionaries
from methods.

Note that a dictionary can only be seen inside of
an array, and every key/value pair is in its own
sd_bus_message container.

Change-Id: I4f8ff671f7c4403d83443482e7db0487bdc03ff1
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# a2f02638 18-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Add missing pointer dereference

When converting a bool from JSON into D-Bus, a
dereference was missing causing the code to always
output a 1 since since it checked the address

REST: Add missing pointer dereference

When converting a bool from JSON into D-Bus, a
dereference was missing causing the code to always
output a 1 since since it checked the address value
and not the actual bool value.

Change-Id: I521418c25bd23c64b59d599f5c5298d8b89cd67c
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# d22a7131 14-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Add method return support for basic types

Add support for returning the basic D-Bus types,
such as int, string, etc, from methods.

It does this by using the sd_bus_message

REST: Add method return support for basic types

Add support for returning the basic D-Bus types,
such as int, string, etc, from methods.

It does this by using the sd_bus_message_read_basic
API to pull the data out of the method response message,
and then converts it to JSON.

Future commits will add array/dict/variant support.

Change-Id: I937d22330a9c2df443942ea84e45d894244388ff
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 16caaee1 15-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Add framework for returning method response

If a method has an output argument in the introspection
data, it has data that should be returned in the response JSON.

This co

REST: Add framework for returning method response

If a method has an output argument in the introspection
data, it has data that should be returned in the response JSON.

This code finds the output type in the introspection
data, and adds two function stubs: one to convert the output
data in the sd_bus message to JSON, and another to handle
combining the possible multiple method responses (from
different services or interfaces) into 1 output.

It also adds some logic on what to do if multiple methods
are called and only a subset fail or return data.
That logic can be summarized as:
* if any method passes, consider it a success
* return all the data that comes back, though the
merging is done in a future commit.

Change-Id: Ic50a3a88bb9d83672f7aed2b832217122e182048
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 318bd892 15-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Return on error in findActionOnInterface

All of the useful code in this function is in an else leg
after an error check. Add a return statement in the error
check so the else

REST: Return on error in findActionOnInterface

All of the useful code in this function is in an else leg
after an error check. Add a return statement in the error
check so the else statement can be removed, to reduce the
level of indent as the code already indents several
additional levels.

Change-Id: Ia664ae2af31a5d72e322dd6c3c83ea8961931e22
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 127ea546 14-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Add missing return statement

Add a missing return statement to convertJsonToDbus.

The function did appear to still work before, but it
fixes a compile warning.

Ch

REST: Add missing return statement

Add a missing return statement to convertJsonToDbus.

The function did appear to still work before, but it
fixes a compile warning.

Change-Id: Ib6b15c822fa6b56c9d9fdaca704bc9c53024fa76
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 4ae611d9 11-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Add missing return statement to dbusArgSplit

The function dbusArgSplit() was missing the return statement
at the end, which was causing a warning in the bitbake
compile logs.

REST: Add missing return statement to dbusArgSplit

The function dbusArgSplit() was missing the return statement
at the end, which was causing a warning in the bitbake
compile logs.

The function apparently still worked fine without it, but
one wouldn't think it would just by looking at it.

Change-Id: Ifcd1f742de995eb19685d0ef37036860ebbf8b95
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# c0eb9bd9 09-Jan-2019 Matt Spinler <spinler@us.ibm.com>

REST: Use status 400 for method arg problems

Use 400, which is a client error, for errors when
deciphering method call arguments as opposed to
a server error, 500. The robot testcas

REST: Use status 400 for method arg problems

Use 400, which is a client error, for errors when
deciphering method call arguments as opposed to
a server error, 500. The robot testcases expect this
and it also makes sense since the client must have
passed in a bad argument.

Only the error that results from a method call failing
will be 500.

Resolves openbmc/bmcweb#25

Change-Id: I9504905992fee3bc0119ff7cae8512eba899daa4
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# f6150403 08-Jan-2019 James Feist <james.feist@linux.intel.com>

Move filesystem from experimental namespace

Splice it into standard for gcc8

Change-Id: I584206dd737c9d90cf93bfa8541980fdd8f6d39b
Signed-off-by: James Feist <james.feist@linux.i

Move filesystem from experimental namespace

Splice it into standard for gcc8

Change-Id: I584206dd737c9d90cf93bfa8541980fdd8f6d39b
Signed-off-by: James Feist <james.feist@linux.intel.com>

show more ...


# ad18f070 14-Nov-2018 Ed Tanous <ed.tanous@intel.com>

bmcweb: Fix issues with /dump endpoint

Technically, if multiple dump files existed, we could get a double end()
called loading each file. Avoid that by returning.

Tested By:

bmcweb: Fix issues with /dump endpoint

Technically, if multiple dump files existed, we could get a double end()
called loading each file. Avoid that by returning.

Tested By:
Downloading a file from dump, using the /dump url. File downloads
correctly.

Change-Id: Icd71a2fbbe365557daa1a7e24c5563f3749a748d
Signed-off-by: Ed Tanous <ed.tanous@intel.com>

show more ...


# 4d72dcc3 26-Dec-2018 AppaRao Puli <apparao.puli@linux.intel.com>

REST: Fixed issues with rest POST method

Fixes the below issues in rest actions
- Fetching dbus signature from xml arg elements.
- Double iterator increament, while reading array

REST: Fixed issues with rest POST method

Fixes the below issues in rest actions
- Fetching dbus signature from xml arg elements.
- Double iterator increament, while reading array
of strings 'as'.

Test:
Verified rest API's with actions(POST).

Change-Id: I52ca938bae54c882da2f9f445ea0b4e605a5f8c3
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>

show more ...


# de81881f 11-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: Add DELETE support

Add support for the DELETE verb. This verb will cause the
Delete method on the xyz.openbmc_project.Object.Delete interface
to be called on the specified obj

REST: Add DELETE support

Add support for the DELETE verb. This verb will cause the
Delete method on the xyz.openbmc_project.Object.Delete interface
to be called on the specified object path. An error will be
returned if that interface/method doesn't exist on that path.

The code is similar to the method handling code, except it
doesn't need to parse any argument JSON, and it is looking only
at a specific interface. It does share the code path that
introspects the object to find a method and call it.

Tested: Used it to delete error logs.

Change-Id: Ica90b0d80049e6bc59fe2b8456948696054f4a8b
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# fbc19ea6 11-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: For PUT, return errors in JSON

This handler is used for setting a D-Bus property.
Return failures as a JSON response.

Change-Id: Ie18abbc78d77d23d3194d76b60d42e877ac54bec

REST: For PUT, return errors in JSON

This handler is used for setting a D-Bus property.
Return failures as a JSON response.

Change-Id: Ie18abbc78d77d23d3194d76b60d42e877ac54bec
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# c4e8d21d 11-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: Add JSON error when no D-Bus handlers found

Add the full JSON error response for the case when
the URL looks like it should correspond to a D-Bus
operation, but doesn't.

REST: Add JSON error when no D-Bus handlers found

Add the full JSON error response for the case when
the URL looks like it should correspond to a D-Bus
operation, but doesn't.

Change-Id: I63a2c05fd8ab3adcdd81d407f9359ebb0279cdc3
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 6db06242 11-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: For /action/<method>, return errors in JSON

This route calls D-Bus methods. Return any errors
encountered in JSON.

Change-Id: I84c6f4abb7092d86ecbc157c95d6343a0b27b7d0

REST: For /action/<method>, return errors in JSON

This route calls D-Bus methods. Return any errors
encountered in JSON.

Change-Id: I84c6f4abb7092d86ecbc157c95d6343a0b27b7d0
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# d6091ddd 06-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: For list, return the error in JSON

The only way list can fail is if the GetSubTreePaths call fails,
and that will only happen if the path isn't a valid D-Bus object.

In th

REST: For list, return the error in JSON

The only way list can fail is if the GetSubTreePaths call fails,
and that will only happen if the path isn't a valid D-Bus object.

In that case, return the standard REST error JSON response for
org.freedesktop.DBus.Error.FileNotFound.

Change-Id: I538d3132552590e51f9ede80762aee00c59cb3e9
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# dc2f9f11 06-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: For GET, return errors in JSON

For the failure cases, return the error messages
in JSON, the same as the python REST server does.

Change-Id: I150fec3ade738d1bd5425a3ea7cce

REST: For GET, return errors in JSON

For the failure cases, return the error messages
in JSON, the same as the python REST server does.

Change-Id: I150fec3ade738d1bd5425a3ea7cceb6c5539f9f6
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 2ae60096 06-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: For enumerate, return the error in JSON

The only way enumerate can fail is if the GetSubTree call fails,
and that will only happen if the path isn't a valid D-Bus object.

REST: For enumerate, return the error in JSON

The only way enumerate can fail is if the GetSubTree call fails,
and that will only happen if the path isn't a valid D-Bus object.

In that case, return the standard REST error JSON response for
org.freedesktop.DBus.Error.FileNotFound.

Change-Id: Ie68761c3ee67aa337761567b8a76bd9c9ebddc19
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 2df1e7db 05-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: For enumerate, try GetAll as last resort

If there are no ObjectManager instances covering a
path that came back from the GetSubTree call, the only
other way to get that path's

REST: For enumerate, try GetAll as last resort

If there are no ObjectManager instances covering a
path that came back from the GetSubTree call, the only
other way to get that path's properties is by directly
reading them.

So, after all of the GetManagedObjects calls are done,
on any of the paths that were in the GetSubTree results
but not in the enumerate results, make a GetAll call to
get the properties and add them to the output.

The code knows when all of the asynchronous GetManagedObjects
calls are done because it is called from the destructor of the
InProgressEnumerateData struct which is passed to all of the
other asio ops via a shared pointer.

Tested: Run on paths that weren't in object managers, such as
the physical LED objects.

Change-Id: I5a62b9a0ee27a68127e6f216625ce93c9ac58d08
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


# 3ae4ba7b 05-Dec-2018 Matt Spinler <spinler@us.ibm.com>

REST: For enumerate, use GetObject for target path

Make a call to GetObject for the target path to get its
connection names and interfaces to add to the GetSubTree
results data befor

REST: For enumerate, use GetObject for target path

Make a call to GetObject for the target path to get its
connection names and interfaces to add to the GetSubTree
results data before looking for object managers in the
GetSubTree data. This is the only way that the code can
find an object manager interface on the target path.

Tested: /enumerate works better

Change-Id: I341b2f46ee7a20793b5f2db15bf4b57b0cbc6d01
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...


123456