tango-controls/cppTango

Support forwarded attributes with #dbase=no (better URI parsing)

Closed this issue · 1 comments

When writing unit tests, it is useful to run devices without a real Tango DB. Typically a file database is used instead. This is approach used by PyTango's (Multi)DeviceTestContext. While trying to add support to the PyTango test context for forwarded attributes, a problem was found with the attribute name parsing.

Consider a device test/device/2 running via a file database, with the following FQDN required for access: tango://172.17.0.4:8888/test/device/2#dbase=no. It is has an attribute, voltage, that we want to forward to another device, test/device/1.

test/device/1 will need a device property with a value for __root_att. The value we need is of the form <fqdn>/<attribute>. However, following the naming specification, it must be:
tango://172.17.0.4:8888/test/device/2/voltage#dbase=no.

The problem is the #dbase=no at the end. The current parsing implementation (here, I think) assumes that we only have <fqdn>/<attribute>. Note that according to the naming specification, including a #dbase=yes suffix is also a valid Tango FQDN, in the case of a real database.

Can the parsing be improved to support this, please? Is there an existing utility class that can correctly deconstruct all valid Tango URIs? It would probably be useful throughout the codebase.

A 9.3 backport would be beneficial - the fix seems unlikely to break ABI compatibility.

t-b commented

Thanks for the report. Makes sense to support dbase=no also in this case. I think

void DeviceProxy::parse_name(std::string &full_name)
does it correctly from a coarsery look.